Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions crates/contextforge-data-plane-lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::sync::Arc;

use axum::middleware;
use axum::{body::Body, middleware, response::Response, routing::get};
use axum_otel_metrics::HttpMetricsLayerBuilder;
use contextforge_data_plane_cpex::GatewayPluginRuntimeHandle;
use futures::FutureExt;
use http::uri::Authority;
use http::{StatusCode, header, uri::Authority};

use rmcp::transport::{
StreamableHttpServerConfig,
Expand Down Expand Up @@ -167,6 +167,7 @@ impl Gateway {

#[cfg(feature = "with_tools")]
let app = tools::add_tools(app);
let app = app.route("/health", get(health));

let app = app.with_state(mcp_gateway_state);
let app = axum::Router::new()
Expand All @@ -184,6 +185,14 @@ pub async fn get_config_store(config: &Config) -> Result<RedisUserConfigStore> {
RedisUserConfigStore::new(&RedisClient::try_from(redis_config)?, cache_expiry).await
}

async fn health() -> Response {
Response::builder()
.status(StatusCode::OK)
.header(header::CONTENT_TYPE, "application/json")
.body(Body::from("{\"status\": \"healthy\"}"))
.expect("Expecting this to work")
}

#[cfg(test)]
mod tests {
use std::sync::Arc;
Expand Down
9 changes: 0 additions & 9 deletions crates/contextforge-data-plane-lib/src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ pub fn add_tools(router: Router<ContextForgeDataPlaneAppState>) -> Router<Contex
.route(TOKEN_PATH, post(get_custom_token))
.route(JWKS_PATH, get(get_jwks))
.route(CONFIGURE_USER_PATH, post(configure_user))
.route("/health", get(health))
}

pub async fn health() -> Response {
Response::builder()
.status(StatusCode::OK)
.header(header::CONTENT_TYPE, "application/json")
.body(Body::from("{\"status\": \"healthy\"}"))
.expect("Expecting this to work")
}

pub async fn get_custom_token(
Expand Down