from functools import lru_cache from pathlib import Path from pydantic_settings import BaseSettings, SettingsConfigDict ENV_PATH = Path(__file__).resolve().parents[2] / ".env" class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=str(ENV_PATH), env_file_encoding="utf-8", extra="ignore") app_name: str = "nex_basse" env: str = "dev" api_v1_prefix: str = "/api/v1" # Database db_type: str = "postgresql" # mysql or postgresql db_host: str = "127.0.0.1" db_port: int = 5432 db_user: str = "postgres" db_password: str = "postgres" db_name: str = "nex_basse" db_echo: bool = False # Redis redis_host: str = "127.0.0.1" redis_port: int = 6379 redis_db: int = 0 redis_password: str | None = None # JWT jwt_secret_key: str = "change_me" jwt_algorithm: str = "HS256" jwt_access_token_minutes: int = 60 jwt_refresh_token_minutes: int = 60 * 24 * 7 # ASR asr_api_base_url: str = "http://localhost:3050" @lru_cache def get_settings() -> Settings: return Settings()