health.rs 682 B

12345678910111213141516171819202122
  1. //! Liveness probe: `GET /healthz`.
  2. //!
  3. //! Dependency-free so it can prove the process is up even when the OAuth
  4. //! backends are not configured yet. The readiness check that touches the
  5. //! session/http-client resources is added in Wave 3.
  6. use axum::Json;
  7. use axum::http::StatusCode;
  8. use axum::response::IntoResponse;
  9. use serde::Serialize;
  10. /// JSON body returned by [`healthz`].
  11. #[derive(Debug, Serialize)]
  12. pub struct HealthBody {
  13. /// Liveness marker; always `"ok"` on a served response.
  14. pub status: &'static str,
  15. }
  16. /// `GET /healthz` -> `200 OK` with `{"status":"ok"}`.
  17. pub async fn healthz() -> impl IntoResponse {
  18. (StatusCode::OK, Json(HealthBody { status: "ok" }))
  19. }