feat: add /api/v1/health public endpoint

- Add public health routes at /api/v1/health, /api/v1/health/detailed, /api/v1/health/consistency
- Make health functions and response types public
- Public routes bypass auth middleware (unlike protected /api/v1/* routes)
This commit is contained in:
Accusys
2026-06-25 10:05:33 +08:00
parent 4273576612
commit ecb0e9c7d0
2 changed files with 14 additions and 6 deletions
+5 -5
View File
@@ -52,7 +52,7 @@ pub fn get_uptime_ms() -> u64 {
}
#[derive(Debug, Serialize)]
struct HealthResponse {
pub struct HealthResponse {
ip: String,
port: u16,
status: String,
@@ -68,7 +68,7 @@ struct HealthResponse {
}
#[derive(Debug, Serialize)]
struct DetailedHealthResponse {
pub struct DetailedHealthResponse {
ip: String,
port: u16,
status: String,
@@ -189,7 +189,7 @@ struct ServiceStatus {
error: Option<String>,
}
async fn health(State(state): State<AppState>) -> Json<HealthResponse> {
pub async fn health(State(state): State<AppState>) -> Json<HealthResponse> {
let postgres = check_postgres().await;
let redis = check_redis().await;
let qdrant = check_qdrant().await;
@@ -222,7 +222,7 @@ async fn health(State(state): State<AppState>) -> Json<HealthResponse> {
})
}
async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHealthResponse> {
pub async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHealthResponse> {
let postgres = check_postgres().await;
let redis = check_redis().await;
let qdrant = check_qdrant().await;
@@ -420,7 +420,7 @@ async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHealthRe
})
}
async fn health_consistency(
pub async fn health_consistency(
State(state): State<AppState>,
) -> Result<Json<crate::core::health_agent::ConsistencyReport>, (StatusCode, String)> {
let report = crate::core::health_agent::run_consistency_checks(&state.db).await;