mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-11 14:04:31 +01:00
remove the create_app macro
This commit is contained in:
parent
2c8f1a43e9
commit
fba9aa214a
@ -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
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
@ -117,15 +117,6 @@ async fn run_http(
|
|||||||
));
|
));
|
||||||
|
|
||||||
app
|
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 allows the server to terminate immediately when a user enter CTRL-C
|
||||||
.disable_signals()
|
.disable_signals()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user