"""Application settings.""" from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """Runtime settings loaded from environment variables.""" app_name: str = "temporal-image-pipeline" api_prefix: str = "/api/v1" debug: bool = False auto_create_tables: bool = True database_url: str = "sqlite+aiosqlite:///./temporal_demo.db" temporal_address: str = "localhost:7233" temporal_namespace: str = "default" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, ) @property def sync_database_url(self) -> str: """Return a synchronous SQLAlchemy URL for migrations.""" return self.database_url.replace("+aiosqlite", "") @lru_cache(maxsize=1) def get_settings() -> Settings: """Return the cached application settings.""" return Settings()