controller: config-apply self-restart + manual restart button (A)
POST /api/config/apply now takes effect via a graceful SELF-RESTART instead of logging "restart needed" and leaving stale in-process singletons (the CF client is built once at startup, so a rotated Cloudflare token never applied until a manual LXC restart). Container is restart:unless-stopped, so a clean os.Exit(0) auto-restarts with fresh config. - New gracefulSelfRestart helper behind an injectable Restarter seam (Router.restart + SetRestarter) so the exit is unit-testable. - configApply: no-op guard (byte-identical re-push → no write, no restart), else write → 200 (flushed) → restart. Removed stale "restart needed" wording. - Removed the dead OnConfigApplied hook (Phase-1-retired infra-backup push; the self-restart reloads everything and a fresh report is pushed on startup). - New POST /api/selfrestart (auth+CSRF via /api/ mount) + "Vezérlő újraindítása" settings button: confirm → POST → poll GET / every 2s → reload. - Tests: changed→restart once; identical→not called (companion); invalid→not called; selfrestart→restart once. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -573,12 +573,6 @@ func main() {
|
||||
|
||||
// --- Initialize API router ---
|
||||
apiRouter := api.NewRouter(cfg, *configPath, sett, stackMgr, syncer, cpuCollector, backupMgr, metricsStore, updater, notifier, logger)
|
||||
if hubPusher != nil {
|
||||
apiRouter.OnConfigApplied = func() {
|
||||
// Infra backup push is now the host agent's responsibility; the controller
|
||||
// only refreshes the Hub report after a config apply.
|
||||
}
|
||||
}
|
||||
if assetsSyncer != nil {
|
||||
apiRouter.SetAssetsSyncer(assetsSyncer)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user