- FastAPI + SQLite backend: tenants, jobs and runs, with an idempotent /api/v1/ingest endpoint authenticated by per-collector API keys - Runs store started_at and finished_at; "Last Run" is the most recent finish, and in-progress runs show as Running - Job modal shows a 30-day daily strip, success rate, and a filterable run list with per-run messages - nginx: HTTPS plus basic auth, ingest endpoint exempt; systemd unit - manage.py for API keys, job cleanup and demo data; pytest suite Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
676 B
Python
23 lines
676 B
Python
import os
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
|
|
# The modal shows this many days of run history; retention can never be shorter.
|
|
HISTORY_DAYS = 30
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Settings:
|
|
db_path: Path
|
|
retention_days: int = 90
|
|
# Dev only: serve ../public from the API so you can run without nginx.
|
|
serve_static: bool = False
|
|
|
|
|
|
def load_settings() -> Settings:
|
|
return Settings(
|
|
db_path=Path(os.environ.get("BACKUP_DASH_DB", "backup-dashboard.db")),
|
|
retention_days=max(HISTORY_DAYS, int(os.environ.get("BACKUP_DASH_RETENTION_DAYS", "90"))),
|
|
serve_static=os.environ.get("BACKUP_DASH_SERVE_STATIC") == "1",
|
|
)
|