Load .env file automatically on startup (#104)

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.
This commit is contained in:
Chris Bartholomew 2026-01-07 03:49:13 -05:00 committed by GitHub
parent 39e3f7c528
commit c06d9b4e4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,11 @@ import logging
import os
from dataclasses import dataclass
from dotenv import find_dotenv, load_dotenv
# Load .env file, searching current and parent directories (overrides existing env vars)
load_dotenv(find_dotenv(usecwd=True), override=True)
logger = logging.getLogger(__name__)
# Environment variable names