"""Application configuration.""" from functools import lru_cache from typing import List from pydantic import Field from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """Application settings.""" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, extra="ignore", ) # Application APP_NAME: str = "AudioForge" DEBUG: bool = False ENVIRONMENT: str = "development" # API API_V1_PREFIX: str = "/api/v1" CORS_ORIGINS: List[str] = Field( default=["http://localhost:3000", "http://localhost:7860"] ) # Database # Default uses port 5433 for Docker development (mapped from container's 5432) DATABASE_URL: str = Field( default="postgresql+asyncpg://postgres:postgres@localhost:5433/audioforge" ) DATABASE_ECHO: bool = False # Redis REDIS_URL: str = Field(default="redis://localhost:6379/0") REDIS_CACHE_TTL: int = 3600 # Music Generation MUSICGEN_MODEL: str = "facebook/musicgen-small" MUSICGEN_DEVICE: str = "cuda" # or "cpu" MUSICGEN_DURATION: int = 30 # seconds # Vocal Generation BARK_MODEL: str = "suno/bark" BARK_DEVICE: str = "cuda" # or "cpu" # Processing MAX_CONCURRENT_GENERATIONS: int = 4 GENERATION_TIMEOUT: int = 300 # seconds # Storage AUDIO_STORAGE_PATH: str = "./storage/audio" MAX_AUDIO_SIZE_MB: int = 100 # Observability LOG_LEVEL: str = "INFO" ENABLE_METRICS: bool = True ENABLE_TRACING: bool = True OTEL_EXPORTER_OTLP_ENDPOINT: str | None = None # Security SECRET_KEY: str = Field( default="change-me-in-production-use-openssl-rand-hex-32" ) ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 @lru_cache() def get_settings() -> Settings: """Get cached settings instance.""" return Settings() settings = get_settings()