mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-11-17 22:03:55 +01:00
feat(config): configurable restart_apply_mode + graceful shutdown (Stage 3b)
- console section: restart_apply_mode (manual | auto), an operator setting (runtime-safe, DB-overridable via /admin/config), env RESTART_APPLY_MODE default manual. - Graceful shutdown: main serve now awaits SIGTERM/Ctrl-C OR an in-app shutdown signal (AppState.shutdown Notify) via with_graceful_shutdown, draining in-flight requests. - PUT /admin/config in `auto` mode self-restarts shortly after responding to apply a restart-required change (systemd Restart=always brings it back with the new config); `manual` just flags restart_pending. The console warns before an auto save. Stage 3 complete: operator config is readable + editable through the real validated, audited, precedence-based layer; runtime-safe edits apply live, infra edits restart. cargo all-targets clean, lib tests pass.
This commit is contained in:
@@ -82,6 +82,10 @@ pub struct AppState {
|
||||
/// Admin token minter/verifier. `Some` only when the admin surface is
|
||||
/// enabled; the admin plane and guard refuse all requests otherwise.
|
||||
pub admin_sessions: Option<AdminSessionManager>,
|
||||
/// Signalled to trigger a graceful shutdown from INSIDE the app — e.g. an operator
|
||||
/// config change in `auto` restart mode. `main` awaits this alongside SIGTERM;
|
||||
/// systemd `Restart=always` brings the instance back with the new config applied.
|
||||
pub shutdown: Arc<tokio::sync::Notify>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
|
||||
Reference in New Issue
Block a user