Add config validation and dashboard

Add YAML config loading with validation, env overrides for secrets, and
a web dashboard exposing health, stats, and recent events.
This commit is contained in:
2026-08-03 12:12:12 -04:00
parent 3f48912ad7
commit 4e1d7cd94a
29 changed files with 2344 additions and 55 deletions
+47
View File
@@ -0,0 +1,47 @@
module main
// WebhookRoute maps a webhook path to its source type and index for O(1) dispatch.
pub enum SourceKind {
gitea
uptime_kuma
cron
generic
}
pub struct WebhookRoute {
kind SourceKind
index int // index in the config's source array
}
// build_webhook_routes constructs a map of webhook_path → WebhookRoute
// for O(1) dispatch instead of scanning all sources on every request.
pub fn build_webhook_routes(cfg Config) map[string]WebhookRoute {
mut routes := map[string]WebhookRoute{}
for i, src in cfg.sources.gitea {
routes[src.webhook_path] = WebhookRoute{
kind: .gitea
index: i
}
}
for i, src in cfg.sources.uptime_kuma {
routes[src.webhook_path] = WebhookRoute{
kind: .uptime_kuma
index: i
}
}
for i, src in cfg.sources.cron {
routes[src.webhook_path] = WebhookRoute{
kind: .cron
index: i
}
}
for i, src in cfg.sources.generic {
routes[src.webhook_path] = WebhookRoute{
kind: .generic
index: i
}
}
return routes
}