0e8f1ca03a
Добавить структурированные журналы, метрики, трассировку и безопасный канал критических ошибок. Усилить границы рантайма, тесты, проверку зависимостей и сценарии развёртывания.
46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
pub mod access;
|
|
pub mod agents;
|
|
pub mod auth;
|
|
pub mod auth_profiles;
|
|
pub mod capabilities;
|
|
pub mod imports;
|
|
pub mod observability;
|
|
pub mod operations;
|
|
pub mod secrets;
|
|
pub mod upstreams;
|
|
pub mod workspaces;
|
|
|
|
use axum::{Json, extract::State, http::StatusCode, response::IntoResponse};
|
|
use serde_json::json;
|
|
|
|
use crate::state::AppState;
|
|
|
|
pub async fn health() -> Json<serde_json::Value> {
|
|
Json(json!({
|
|
"service": "admin-api",
|
|
"status": "ok"
|
|
}))
|
|
}
|
|
|
|
pub async fn readiness(State(state): State<AppState>) -> impl IntoResponse {
|
|
match state.service.readiness().await {
|
|
Ok(()) => (
|
|
StatusCode::OK,
|
|
Json(json!({
|
|
"service": "admin-api",
|
|
"status": "ready",
|
|
"checks": { "postgres": "ready" }
|
|
})),
|
|
),
|
|
Err(error) => (
|
|
StatusCode::SERVICE_UNAVAILABLE,
|
|
Json(json!({
|
|
"service": "admin-api",
|
|
"status": "not_ready",
|
|
"checks": { "postgres": "not_ready" },
|
|
"error": error.to_string()
|
|
})),
|
|
),
|
|
}
|
|
}
|