from functools import lru_cache from typing import Literal from pydantic import Field from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore") DATABASE_URL: str = Field(default="postgresql+asyncpg://postgres:postgres@db:5432/ctms") ENV: Literal["development", "production", "test"] = "development" JWT_SECRET_KEY: str = "dev-secret" JWT_EXPIRE_MINUTES: int = 60 JWT_EXTEND_GRACE_SECONDS: int = 120 ABSOLUTE_SESSION_MAX_HOURS: int = 8 @lru_cache def get_settings() -> Settings: return Settings() settings = get_settings()