Skip to content

Commit

Permalink
Merge pull request #4481 from systeminit/health
Browse files Browse the repository at this point in the history
feat: serve healthcheck endpoint in maintenance mode.
  • Loading branch information
sprutton1 authored Sep 4, 2024
2 parents 43b7664 + d5d24ec commit ef68af4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/sdf-server/src/server/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ async fn app_state_middeware<B>(
pub fn routes(state: AppState) -> Router {
let mut router: Router<AppState> = Router::new();
router = router
// root health route is currently pinged by auth portal to check if backend is up and running so we need permissive CORS headers
.nest(
"/api/",
Router::new().route("/", get(system_status_route).layer(CorsLayer::permissive())),
)
.nest("/api/action", crate::server::service::action::routes())
.nest(
"/api/node_debug",
Expand Down Expand Up @@ -105,7 +100,13 @@ pub fn routes(state: AppState) -> Router {
.layer(middleware::from_fn_with_state(
state.clone(),
app_state_middeware,
));
))
// root health route is currently pinged by auth portal to check if backend is up and running so we need permissive CORS headers
// it is last in the list so that it still services even if we are in maintenance mode
.nest(
"/api/",
Router::new().route("/", get(system_status_route).layer(CorsLayer::permissive())),
);

// Load dev routes if we are in dev mode (decided by "opt-level" at the moment).
router = dev_routes(router);
Expand Down

0 comments on commit ef68af4

Please sign in to comment.