aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/api/health.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/health.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/health.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/health.py b/packages/meshbay-hub/src/meshbay_hub/api/health.py
new file mode 100644
index 0000000..516856b
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/api/health.py
@@ -0,0 +1,21 @@
+"""Healthcheck endpoint — no auth required (monitoring probes)."""
+
+from fastapi import APIRouter, Depends
+from sqlalchemy import text
+from sqlalchemy.ext.asyncio import AsyncSession
+
+from meshbay_hub import __version__
+from meshbay_hub.api.revocation import get_connected_node_count
+from meshbay_hub.db.engine import get_db
+
+router = APIRouter(tags=["health"])
+
+
+@router.get("/v1/health")
+async def health(db: AsyncSession = Depends(get_db)):
+ await db.execute(text("SELECT 1"))
+ return {
+ "status": "ok",
+ "version": __version__,
+ "connected_nodes": get_connected_node_count(),
+ }