1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
//! An actix-web service to introspect Merino if the `debug` setting is enabled.
//! The handlers here should all verify that debug is enabled.
use actix_web::{
get,
web::{self, Data},
HttpResponse,
};
use merino_settings::Settings;
/// Handles required Dockerflow Endpoints.
pub fn configure(config: &mut web::ServiceConfig) {
config.service(settings);
}
/// In debug mode, show the settings of the app.
#[get("settings")]
async fn settings(settings: Data<Settings>) -> HttpResponse {
if settings.debug {
HttpResponse::Ok().json(settings)
} else {
HttpResponse::NotFound().body("")
}
}