use crate::app::config::Configuration;
use crate::web::maintenance::MaintenanceMode;
use rocket::Build;
use rocket::Rocket;

pub fn init(config: &Configuration) -> super::InfallibleResult<MaintenanceMode> {
    Ok(Some(MaintenanceMode::new(config.maintenance_file.clone())))
}

pub fn register(
    rocket: Rocket<Build>,
    _config: &Configuration,
    fairing: MaintenanceMode,
) -> Rocket<Build> {
    rocket.attach(fairing)
}
