from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """Configuration applicative, alimentée par l'environnement.""" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", extra="ignore" ) environment: str = "development" database_url: str = ( "postgresql+psycopg://benevoles:benevoles@localhost:5432/benevoles" ) test_database_url: str = ( "postgresql+psycopg://benevoles:benevoles@localhost:5432/benevoles_test" ) # Utilisés par l'étape authentification (lien magique). Pas encore actifs. jwt_secret: str = "dev-only-change-me" magic_link_ttl_minutes: int = 30 log_level: str = "INFO" cors_origins: list[str] = ["http://localhost:5173"] @property def is_production(self) -> bool: return self.environment == "production" @lru_cache def get_settings() -> Settings: return Settings()