import sys from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/umbra" SECRET_KEY: str = "your-secret-key-change-in-production" ENVIRONMENT: str = "development" COOKIE_SECURE: bool = False model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=True ) settings = Settings() if settings.SECRET_KEY == "your-secret-key-change-in-production": if settings.ENVIRONMENT != "development": print( "FATAL: Default SECRET_KEY detected in non-development environment. " "Set a unique SECRET_KEY in .env immediately.", file=sys.stderr, ) sys.exit(1) else: print( "WARNING: Using default SECRET_KEY. Set SECRET_KEY in .env for production.", file=sys.stderr, )