Skip to content

Commit c33d254

Browse files
committed
feat(guard): add http ping endpoint to edge api hosts (#2506)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
1 parent a3cb3ec commit c33d254

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/edge/infra/guard/server/src/routing/api.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use chirp_workflow::prelude::*;
22
use cluster::types::{Filter, PoolType};
33
use global_error::GlobalResult;
4-
use rivet_guard_core::proxy_service::{RouteConfig, RouteTarget, RoutingOutput, RoutingTimeout};
4+
use rivet_guard_core::proxy_service::{RouteConfig, RouteTarget, RoutingOutput, RoutingTimeout, StructuredResponse};
5+
use rivet_guard_core::status::StatusCode;
6+
use std::borrow::Cow;
57
use uuid::Uuid;
68

79
/// Route requests to the API service
@@ -26,6 +28,15 @@ pub async fn route_api_request(
2628
}
2729
}
2830

31+
// Handle ping endpoint
32+
if path == "/ping" {
33+
return Ok(Some(RoutingOutput::Response(StructuredResponse {
34+
status: StatusCode::OK,
35+
message: Cow::Borrowed("ok"),
36+
docs: None,
37+
})));
38+
}
39+
2940
// Get API server from the cluster
3041
let servers_res = ctx
3142
.op(cluster::ops::server::list::Input {

0 commit comments

Comments
 (0)