Skip to main content

admin_toggle_handler

Function admin_toggle_handler 

Source
pub async fn admin_toggle_handler(
    __arg0: State<Arc<MaintenanceState>>,
    headers: HeaderMap,
    __arg2: Json<MaintenanceUpdate>,
) -> Response
Expand description

POST /maintenance — auth-gated by the MAINTENANCE_ADMIN_TOKEN env var.

  • If the env var is unset → 501 Not Implemented (closed by default).
  • If Authorization: Bearer <token> (or X-Maintenance-Admin-Token) does not match → 401.
  • On match → applies the update and returns the new snapshot.