update
This commit is contained in:
@@ -6,14 +6,25 @@ from dotenv import load_dotenv
|
||||
from pathlib import Path
|
||||
|
||||
# Load environment variables from backend/.env
|
||||
backend_dir = Path(__file__).parent.parent / 'backend'
|
||||
env_path = backend_dir / '.env'
|
||||
# Try multiple locations (Docker vs local)
|
||||
env_locations = [
|
||||
Path('/app/.env'), # Docker location
|
||||
Path(__file__).parent.parent / 'backend' / '.env', # Local location
|
||||
Path(__file__).parent / '.env', # Current directory
|
||||
]
|
||||
|
||||
if env_path.exists():
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
print(f"✓ Loaded configuration from: {env_path}")
|
||||
else:
|
||||
print(f"⚠ Warning: .env file not found at {env_path}")
|
||||
env_loaded = False
|
||||
for env_path in env_locations:
|
||||
if env_path.exists():
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
print(f"✓ Loaded configuration from: {env_path}")
|
||||
env_loaded = True
|
||||
break
|
||||
|
||||
if not env_loaded:
|
||||
print(f"⚠ Warning: .env file not found in any of these locations:")
|
||||
for loc in env_locations:
|
||||
print(f" - {loc}")
|
||||
|
||||
|
||||
class Config:
|
||||
|
||||
Reference in New Issue
Block a user