From fba9aa214aa0a5e1aeacc07d3152991828c69fcd Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 27 Sep 2022 16:38:45 +0200 Subject: [PATCH] remove the create_app macro --- meilisearch-http/src/lib.rs | 49 ------------------------------------ meilisearch-http/src/main.rs | 9 ------- 2 files changed, 58 deletions(-) diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index 7a29c3d27..d43f864b0 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -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 - }}; -} diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs index 86dccf84d..b72c53911 100644 --- a/meilisearch-http/src/main.rs +++ b/meilisearch-http/src/main.rs @@ -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()