1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Built-in health check endpoints for Rapina.
//!
//! When enabled via [`.with_health_check(true)`](crate::app::Rapina::with_health_check),
//! three endpoints are registered:
//!
//! | Endpoint | Handler | Purpose |
//! |---|---|---|
//! | `GET /__rapina/health` | [`health_check`] | Alias for `/ready` — simple setups and load balancers |
//! | `GET /__rapina/health/live` | [`liveness_check`] | Kubernetes liveness probe — always `200` |
//! | `GET /__rapina/health/ready` | [`readiness_check`] | Kubernetes readiness probe — runs all checks |
//!
//! # Response format
//!
//! All endpoints return JSON. When all checks pass:
//!
//! ```json
//! { "status": "ok" }
//! ```
//!
//! When checks are configured (database or custom), they appear under `"checks"`:
//!
//! ```json
//! {
//! "status": "ok",
//! "checks": {
//! "db": "ok",
//! "redis": "ok"
//! }
//! }
//! ```
//!
//! If any check fails, `"status"` is `"error"` and the HTTP status code is `503`:
//!
//! ```json
//! {
//! "status": "error",
//! "checks": {
//! "db": "error",
//! "redis": "ok"
//! }
//! }
//! ```
//!
//! # Built-in checks
//!
//! - **`db`** — when the `database` feature is enabled and a [`DatabaseConnection`](sea_orm::DatabaseConnection)
//! is in state, a `SELECT 1` query is executed to verify connectivity.
//! Only runs on `/ready` and `/__rapina/health`, never on `/live`.
//!
//! # Custom checks
//!
//! Register additional checks via [`Rapina::add_health_check`](crate::app::Rapina::add_health_check).
//! All custom checks run on `/ready` (and its `/health` alias):
//!
//! ```ignore
//! Rapina::new()
//! .with_health_check(true)
//! .add_health_check("redis", || async {
//! redis_ping().await.is_ok()
//! })
//! .add_health_check("stripe", || async {
//! stripe_ping().await.is_ok()
//! })
//! .listen("127.0.0.1:3000")
//! .await
//! ```
pub use HealthRegistry;
pub use ;