"""Application settings, read from environment variables. Single SQLite database (see docs/DECISIONS.md D15 for why this isn't the two-role Postgres+RLS setup Phase 0 originally shipped with) — one DSN, one engine, no BYPASSRLS/NOBYPASSRLS split. Isolation between users is enforced entirely by the repository-layer scope now; see db.py and CLAUDE.md's invariant #4. """ from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_prefix="VELODROME_", extra="ignore") # A SQLAlchemy URL, e.g. sqlite+aiosqlite:////data/velodrome.db. Not typed as a stricter DSN # (pydantic has no built-in sqlite+aiosqlite validator) — Alembic and the app both read this # same setting, so keep it a plain string rather than inventing a validator neither needs. database_url: str = "sqlite+aiosqlite:///./velodrome.db" # AES-GCM key for encrypting third-party credentials (e.g. the Bryton digest, added in a later # phase). Not used yet in Phase 0, but declared now so the settings shape is stable. secret_key: str = "dev-only-insecure-placeholder-change-me" session_cookie_name: str = "vd_session" session_ttl_days: int = 90 public_url: str = "http://localhost:5173" environment: str = "development" @lru_cache def get_settings() -> Settings: return Settings()