feat: v0.2.0 branding, healthz version, SSE dashboard live

Centralize APP_VERSION 0.2.0; /health and /healthz return version;
startup log line; UI title Security Alert Center v.0.2.0;
SSE /api/v1/stream/events for live dashboard counters.
This commit is contained in:
PTah
2026-05-27 13:20:39 +10:00
parent ea221db3c7
commit c657a65970
15 changed files with 197 additions and 25 deletions
+15 -2
View File
@@ -3,12 +3,12 @@ from sqlalchemy import text
from sqlalchemy.orm import Session
from app.database import get_db
from app.version import APP_NAME, APP_VERSION
router = APIRouter(tags=["health"])
@router.get("/health")
def health(db: Session = Depends(get_db)) -> dict:
def build_health_payload(db: Session) -> dict:
db_status = "ok"
try:
db.execute(text("SELECT 1"))
@@ -18,4 +18,17 @@ def health(db: Session = Depends(get_db)) -> dict:
"status": "ok" if db_status == "ok" else "degraded",
"database": db_status,
"service": "security-alert-center",
"name": APP_NAME,
"version": APP_VERSION,
}
@router.get("/health")
def health(db: Session = Depends(get_db)) -> dict:
return build_health_payload(db)
@router.get("/healthz")
def healthz(db: Session = Depends(get_db)) -> dict:
"""Kubernetes-style alias; same payload as /health."""
return build_health_payload(db)