Expand description
Maintenance mode middleware.
Set MAINTENANCE_MODE to true at runtime to return 503 Service Unavailable for all requests except /healthz and /readyz. Clear it to
resume normal traffic.
§Example
use rust_web_server::app::App;
use rust_web_server::core::New;
use rust_web_server::maintenance::{MAINTENANCE_MODE, MaintenanceLayer};
use std::sync::atomic::Ordering;
let app = App::new().wrap(MaintenanceLayer);
// Enable maintenance mode at runtime.
MAINTENANCE_MODE.store(true, Ordering::SeqCst);Structs§
- Maintenance
Layer - Middleware that returns
503whenMAINTENANCE_MODEistrue.
Statics§
- MAINTENANCE_
MODE - Flip to
trueto activate maintenance mode; back tofalseto resume.