Skip to content

Conversation

@cdbartholomew
Copy link
Contributor

Summary

  • Add automatic .env file loading using python-dotenv on startup
  • Searches current working directory and parent directories for .env file
  • Uses override=True so .env values take precedence over shell environment

Motivation

When running uv run hindsight-api from a project directory, users expect the .env file to be loaded automatically without needing to manually source it (set -a; source .env; set +a).

Test plan

  • Run uv run hindsight-api from a directory with a .env file containing HINDSIGHT_API_LOG_LEVEL=info
  • Verify log level is respected without manually exporting the variable
  • Verify existing tests pass

Add automatic .env file loading using python-dotenv. This searches
the current working directory and parent directories for a .env file
and loads environment variables from it.

Uses override=True so .env file values take precedence over existing
shell environment variables, which is the expected behavior when
running from a project directory.
@nicoloboschi nicoloboschi merged commit c06d9b4 into main Jan 7, 2026
47 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants