from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", extra="ignore", ) # --- App --- env: str = "development" log_level: str = "info" port: int = 8002 # --- LLM --- groq_api_key: str nvidia_api_key: str = "" # --- Internal service auth (shared secret with Django) --- chat_service_internal_token: str = "" # --- Postgres (read-only role) --- postgres_readonly_url: str = "" # --- Neo4j (Aura Free — no RBAC, enforcement is app-level only) --- neo4j_uri: str = "" neo4j_user: str = "" neo4j_password: str = "" # --- Redis --- redis_url: str = "" # --- Chat session behavior --- chat_session_ttl_seconds: int = 86400 chat_history_max_turns: int = 10 # --- NLP EMBED --- nlp_service_url: str = "" nlp_service_token: str = "" @lru_cache def get_settings() -> Settings: """Cached settings instance — reads .env once per process.""" return Settings()