"""Application configuration using Pydantic Settings.""" import secrets from functools import lru_cache from pydantic import Field from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """Application settings loaded from environment variables.""" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, ) # Database (port 5433 to avoid conflict with existing Postgres) DATABASE_URL: str = "postgresql+asyncpg://orchestrator:orchestrator@localhost:5433/orchestrator" # Application DEBUG: bool = False APP_NAME: str = "LetsBe Orchestrator" APP_VERSION: str = "0.1.0" # Connection pool settings DB_POOL_SIZE: int = 5 DB_MAX_OVERFLOW: int = 10 DB_POOL_TIMEOUT: int = 30 DB_POOL_RECYCLE: int = 1800 # Authentication # Admin API key for protected endpoints (registration token management) # In production, this MUST be set via ADMIN_API_KEY environment variable ADMIN_API_KEY: str = Field( default_factory=lambda: secrets.token_hex(32), description="API key for admin endpoints. Set via ADMIN_API_KEY env var in production.", ) @lru_cache def get_settings() -> Settings: """Get cached settings instance.""" return Settings() # For backward compatibility settings = get_settings()