"""Application settings using Pydantic Settings.""" from pydantic import Field, SecretStr from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """Runtime application configuration.""" model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="allow") project_name: str = "Test Task CRM" version: str = "0.1.0" api_v1_prefix: str = "/api/v1" database_url: str = Field( default="postgresql+asyncpg://postgres:postgres@0.0.0.0:5432/test_task_crm", description="SQLAlchemy async connection string", ) sqlalchemy_echo: bool = False jwt_secret_key: SecretStr = Field(default=SecretStr("change-me")) jwt_algorithm: str = "HS256" access_token_expire_minutes: int = 30 refresh_token_expire_days: int = 7 redis_enabled: bool = Field(default=False, description="Toggle Redis-backed cache usage") redis_url: str = Field(default="redis://localhost:6379/0", description="Redis connection URL") analytics_cache_ttl_seconds: int = Field(default=120, ge=1, description="TTL for cached analytics responses") analytics_cache_backoff_ms: int = Field( default=200, ge=0, description="Maximum backoff (ms) for retrying cache writes/invalidation", ) settings = Settings()