feat: Add new status page

This commit is contained in:
2026-04-04 11:36:30 +11:00
parent ff3f40beaf
commit d66fd8f58e
43 changed files with 1342 additions and 2427 deletions

View File

@@ -0,0 +1,34 @@
from __future__ import annotations
from apscheduler.schedulers.background import BackgroundScheduler
from hnsdoh_status.checks import run_full_check
from hnsdoh_status.config import Settings
from hnsdoh_status.store import StatusStore
def create_scheduler(settings: Settings, store: StatusStore) -> BackgroundScheduler:
scheduler = BackgroundScheduler(daemon=True)
def run_checks() -> None:
snapshot = run_full_check(
domain=settings.domain,
doh_path=settings.doh_path,
dns_timeout=settings.dns_timeout_seconds,
doh_timeout=settings.doh_timeout_seconds,
dot_timeout=settings.dot_timeout_seconds,
)
store.update(snapshot)
# Run once on startup so the UI/API is populated immediately.
run_checks()
scheduler.add_job(
run_checks,
"interval",
seconds=settings.check_interval_seconds,
id="node-health-check",
max_instances=1,
coalesce=True,
)
return scheduler