"""# 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 template reads these knobs: - ``repo_backend`` — ``memory`` (default, zero-dependency process-local store) or ``mongo`` (persistent, via the shared mongo-ops connection manager). - ``mongo_uri`` / ``mongo_db`` — connection targets when the Mongo backend is selected. - ``port`` — the port uvicorn binds (keep in sync with the OpenAPI ``servers:`` entry and the client's ``VITE_API_BASE_URL``). - ``worker_poll_seconds`` / ``worker_max_retries`` — background worker cadence. ``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 app_template. port (int): Local HTTP port. Defaults to 8000. worker_poll_seconds (int): Worker poll interval in seconds. Defaults to 30. worker_max_retries (int): Maximum job retries before skipping. Defaults to 3. """ debug: bool = False repo_backend: str = "memory" mongo_uri: str = "mongodb://localhost:27017" mongo_db: str = "app_template" port: int = 8000 worker_poll_seconds: int = 30 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", "app_template"), port=int(os.environ.get("PORT", "8000")), worker_poll_seconds=int(os.environ.get("WORKER_POLL_SECONDS", "30")), worker_max_retries=int(os.environ.get("WORKER_MAX_RETRIES", "3")), )