from functools import lru_cache from pathlib import Path from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", extra="ignore") database_url: str = "postgresql+asyncpg://pgames:pgames@db:5432/pgames" data_dir: Path = Path("/data") secret_key: str = "change-me" session_ttl_hours: int = 24 * 14 cookie_secure: bool = False admin_username: str = "admin" admin_password: str = "admin" worker_poll_seconds: float = 2.0 worker_threads: int = 4 unrpyc_path: Path = Path("/opt/unrpyc/unrpyc.py") @property def blobs_dir(self) -> Path: return self.data_dir / "blobs" @property def uploads_dir(self) -> Path: return self.data_dir / "uploads" @property def work_dir(self) -> Path: return self.data_dir / "work" @lru_cache def get_settings() -> Settings: return Settings()