remove the create_app macro

This commit is contained in:
Tamo 2022-09-27 16:38:45 +02:00 committed by Clément Renault
parent 2c8f1a43e9
commit fba9aa214a
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
2 changed files with 0 additions and 58 deletions

View File

@ -157,52 +157,3 @@ pub fn configure_metrics_route(config: &mut web::ServiceConfig, enable_metrics_r
);
}
}
#[macro_export]
macro_rules! create_app {
($data:expr, $auth:expr, $enable_frontend:expr, $opt:expr, $analytics:expr) => {{
use actix_cors::Cors;
use actix_web::dev::Service;
use actix_web::middleware::Condition;
use actix_web::middleware::TrailingSlash;
use actix_web::App;
use actix_web::{middleware, web};
use meilisearch_http::error::MeilisearchHttpError;
use meilisearch_http::routes;
use meilisearch_http::{configure_data, dashboard};
#[cfg(feature = "metrics")]
use meilisearch_http::{configure_metrics_route, metrics, route_metrics};
use meilisearch_types::error::ResponseError;
let app = App::new()
.configure(|s| configure_data(s, $data, $auth.clone(), &$opt, $analytics))
.configure(routes::configure)
.configure(|s| dashboard(s, $enable_frontend));
#[cfg(feature = "metrics")]
let app = app.configure(|s| configure_metrics_route(s, $opt.enable_metrics_route));
let app = app
.wrap(
Cors::default()
.send_wildcard()
.allow_any_header()
.allow_any_origin()
.allow_any_method()
.max_age(86_400), // 24h
)
.wrap(middleware::Logger::default())
.wrap(middleware::Compress::default())
.wrap(middleware::NormalizePath::new(
middleware::TrailingSlash::Trim,
));
#[cfg(feature = "metrics")]
let app = app.wrap(Condition::new(
$opt.enable_metrics_route,
route_metrics::RouteMetrics,
));
app
}};
}

View File

@ -117,15 +117,6 @@ async fn run_http(
));
app
/*
create_app!(
index_scheduler.clone(),
auth_controller.clone(),
enable_dashboard,
opt,
analytics.clone()
)
*/
})
// Disable signals allows the server to terminate immediately when a user enter CTRL-C
.disable_signals()