about summary refs log tree commit diff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2bba755..c3efcca 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -154,6 +154,10 @@ struct VersionInfo {
     source_digest: &'static str,
     /// The branch the build's HEAD was on, or "HEAD" when detached.
     branch: &'static str,
+    /// Whether the database answers, checked at most every ten seconds.
+    /// A service that answers `/version` while every data endpoint fails
+    /// is the state this makes visible.
+    database: &'static str,
 }
 
 #[utoipa::path(get, path = "/version", summary = "Build information: the git commit the binary was built from, and a source digest", responses(
@@ -176,5 +180,10 @@ async fn version(ctx: Ctx) -> Json<Envelope<VersionInfo>> {
         dirty: git.ends_with("-dirty"),
         source_digest: env!("GN4_SOURCE_DIGEST"),
         branch: env!("GN4_GIT_BRANCH"),
+        database: if crate::db::health() {
+            "reachable"
+        } else {
+            "unreachable"
+        },
     }))
 }