Skip to main content

Module maintenance

Module maintenance 

Source
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§

MaintenanceLayer
Middleware that returns 503 when MAINTENANCE_MODE is true.

Statics§

MAINTENANCE_MODE
Flip to true to activate maintenance mode; back to false to resume.