Add python-dotenv support for automatic .env loading
- Added python-dotenv to requirements.txt - Config now automatically loads .env file if present - Allows local development without manually exporting env vars - Gracefully falls back if python-dotenv not installed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7988e2751a
commit
d616b87701
@ -16,6 +16,15 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
# Load .env file if it exists
|
||||||
|
try:
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
_env_path = Path(__file__).parent / ".env"
|
||||||
|
if _env_path.exists():
|
||||||
|
load_dotenv(_env_path)
|
||||||
|
except ImportError:
|
||||||
|
pass # python-dotenv not installed
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class ElasticSettings:
|
class ElasticSettings:
|
||||||
|
|||||||
@ -2,3 +2,4 @@ Flask>=2.3
|
|||||||
elasticsearch>=7.0.0,<9.0.0
|
elasticsearch>=7.0.0,<9.0.0
|
||||||
youtube-transcript-api>=0.6
|
youtube-transcript-api>=0.6
|
||||||
google-api-python-client>=2.0.0
|
google-api-python-client>=2.0.0
|
||||||
|
python-dotenv>=0.19.0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user