"""# Summary App configuration loaded from environment — a Settings dataclass with defaults plus a singleton settings instance populated from OS environment variables at import time. --- The server reads six knobs: - ``repo_backend`` — ``memory`` (default, zero-dependency demo store) or ``mongo`` (persistent, via the shared mongo-ops connection manager). - ``mongo_uri`` / ``mongo_db`` — connection targets when the Mongo backend is selected. - ``uploads_dir`` — directory that receives uploaded pet photos. - ``port`` — the port uvicorn binds (kept in sync with the OpenAPI ``servers:`` entry and the frontend's ``VITE_API_BASE_URL``). - ``worker_poll_seconds`` — background worker poll cadence. - ``worker_max_retries`` — failed-attempt budget before a job is skipped. ``AUTH_SERVER`` is intentionally *not* re-exported here: ``openapi_first`` resolves ``{AUTH_SERVER}`` straight from the process environment when the application is built, so the env var remains the single source of truth for the generated bearer-JWT introspection dependency. """ import os from dataclasses import dataclass @dataclass class Settings: """Runtime configuration settings for the application. Attributes: debug (bool): Enable debug behavior. Defaults to False. repo_backend (str): Persistence flavour, ``memory`` or ``mongo``. Defaults to ``memory``. mongo_uri (str): MongoDB connection URI. Defaults to mongodb://localhost:27017. mongo_db (str): MongoDB database name. Defaults to vet. auth_server (str): Auth-server base URL surfaced to operators and scripts. Defaults to https://auth.aetoskia.com. port (int): Local HTTP port. Defaults to 8020. uploads_dir (str): Directory for uploaded pet photos. Defaults to uploads. worker_poll_seconds (float): Worker poll cadence in seconds. Defaults to 5. worker_max_retries (int): Failed attempts before a job is skipped. Defaults to 3. """ debug: bool = False repo_backend: str = "memory" mongo_uri: str = "mongodb://localhost:27017" mongo_db: str = "vet" auth_server: str = "https://auth.aetoskia.com" port: int = 8020 uploads_dir: str = "uploads" worker_poll_seconds: float = 5.0 worker_max_retries: int = 3 settings = Settings( debug=os.environ.get("DEBUG", "").lower() in ("1", "true", "yes"), repo_backend=os.environ.get("REPO_BACKEND", "memory").lower(), mongo_uri=os.environ.get("MONGO_URI", "mongodb://localhost:27017"), mongo_db=os.environ.get("MONGO_DB", "vet"), auth_server=os.environ.get("AUTH_SERVER", "https://auth.aetoskia.com"), port=int(os.environ.get("PORT", "8020")), uploads_dir=os.environ.get("UPLOADS_DIR", "uploads"), worker_poll_seconds=float(os.environ.get("WORKER_POLL_SECONDS", "5")), worker_max_retries=int(os.environ.get("WORKER_MAX_RETRIES", "3")), )