diff options
| author | Rutger Broekhoff | 2026-08-29 14:36:36 +0200 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-08-29 14:36:36 +0200 |
| commit | 999d77a9bcfa90f002b0107ea5fc7e6abc51dd9c (patch) | |
| tree | 15f2154ba28139ab87602bcb53f1451e5b8bfd6b /server/src/srv.cpp | |
| parent | 783ec01cbe2007c2ccf723635166c08f6d26abee (diff) | |
| download | routemon-999d77a9bcfa90f002b0107ea5fc7e6abc51dd9c.tar.gz routemon-999d77a9bcfa90f002b0107ea5fc7e6abc51dd9c.zip | |
Deployment preparations
Diffstat (limited to 'server/src/srv.cpp')
| -rw-r--r-- | server/src/srv.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/src/srv.cpp b/server/src/srv.cpp index 00a2bb8..b70f05c 100644 --- a/server/src/srv.cpp +++ b/server/src/srv.cpp | |||
| @@ -232,22 +232,24 @@ auto handler::make_routes() -> http::route_tree<http::routed_ctx<outer_ctx>> | |||
| 232 | }); | 232 | }); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | auto server::make_global_middleware() | 235 | auto server::make_global_middleware(config::http_server const& cfg) |
| 236 | -> http::middleware_t<http::base_ctx, handler::outer_ctx> | 236 | -> http::middleware_t<http::base_ctx, handler::outer_ctx> |
| 237 | { | 237 | { |
| 238 | return http::middleware_compose< | 238 | return http::middleware_compose< |
| 239 | http::base_ctx, http::trace_id_ctx<http::base_ctx>, | 239 | http::base_ctx, http::trace_id_ctx<http::base_ctx>, |
| 240 | http::trace_id_ctx<http::base_ctx> | 240 | http::trace_id_ctx<http::base_ctx> |
| 241 | >(http::trace_id_middleware<http::base_ctx>, | 241 | >(http::trace_id_middleware<http::base_ctx>, |
| 242 | http::lax_cors_middleware<http::trace_id_ctx<http::base_ctx>>); | 242 | http::cors_middleware<http::trace_id_ctx<http::base_ctx>>( |
| 243 | cfg.allow_origins)); | ||
| 243 | } | 244 | } |
| 244 | 245 | ||
| 245 | server::server( | 246 | server::server( |
| 246 | log::logger const& l, locale::selector&& lsel, api::handler&& inner) | 247 | log::logger const& l, config::http_server const& cfg, |
| 248 | locale::selector&& lsel, api::handler&& inner) | ||
| 247 | : handler_{std::move(inner)}, | 249 | : handler_{std::move(inner)}, |
| 248 | srv_{ | 250 | srv_{ |
| 249 | l, http::router{ | 251 | l, http::router{ |
| 250 | std::move(lsel), make_global_middleware(), handler_.make_routes() | 252 | std::move(lsel), make_global_middleware(cfg), handler_.make_routes() |
| 251 | } | 253 | } |
| 252 | } | 254 | } |
| 253 | { | 255 | { |