"""Application configuration via pydantic-settings.""" from pydantic_settings import BaseSettings from functools import lru_cache class Settings(BaseSettings): # App APP_NAME: str = "AGP Backend" APP_VERSION: str = "0.1.0" DEBUG: bool = True # Database (async) DATABASE_URL: str = "postgresql+asyncpg://agp_user:agp_password@localhost:5432/agp_db" # Redis REDIS_URL: str = "redis://localhost:6379/0" # JWT / Auth SECRET_KEY: str = "change-me-to-a-secure-random-string" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 # CORS CORS_ORIGINS: str = "http://localhost:8080,http://localhost:3000" # File uploads UPLOAD_DIR: str = "uploads" MAX_UPLOAD_SIZE_MB: int = 100 @property def cors_origins_list(self) -> list[str]: return [origin.strip() for origin in self.CORS_ORIGINS.split(",")] class Config: env_file = ".env" env_file_encoding = "utf-8" case_sensitive = True @lru_cache() def get_settings() -> Settings: """Return cached settings instance.""" return Settings() # Convenience singleton settings = get_settings()