Description
The ai-service loads .env from a hardcoded relative path which will break depending on where the service is started from.
Location
File: backend/ai-service/app/main.py
Line: 17
Current Code
load_dotenv("../../.env") # Hardcoded relative path
Problem
- Only works if cwd is
backend/ai-service/app/
- Fails when running with uvicorn from project root
- Fails in Docker containers
- Fragile and error-prone
Suggested Fix
import os
from pathlib import Path
# Get the project root (3 levels up from this file)
env_path = Path(__file__).parent.parent.parent.parent / ".env"
load_dotenv(env_path)
Or use environment variable directly without dotenv in production.
Labels
enhancement, ai-service, config
Description
The ai-service loads
.envfrom a hardcoded relative path which will break depending on where the service is started from.Location
File:
backend/ai-service/app/main.pyLine: 17
Current Code
Problem
backend/ai-service/app/Suggested Fix
Or use environment variable directly without dotenv in production.
Labels
enhancement, ai-service, config