mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 08:57:15 -05:00
Add unified health and version reporting
This commit is contained in:
@@ -64,6 +64,15 @@ async def serve_prism_console():
|
||||
return FileResponse(prism_index)
|
||||
|
||||
|
||||
@router.get("/prism/health")
|
||||
async def prism_health():
|
||||
"""Health endpoint for Prism Console assets."""
|
||||
return {
|
||||
"service": "prism-console",
|
||||
"status": "healthy",
|
||||
}
|
||||
|
||||
|
||||
@router.get("/prism/{file_path:path}")
|
||||
async def serve_prism_static_files(file_path: str):
|
||||
"""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""System endpoints for core OS operations"""
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
import os
|
||||
|
||||
from app.config import settings
|
||||
@@ -22,7 +22,7 @@ async def get_version():
|
||||
|
||||
return {
|
||||
"version": settings.APP_VERSION,
|
||||
"build_time": datetime.utcnow().isoformat(),
|
||||
"build_time": datetime.now(timezone.utc).isoformat(),
|
||||
"env": settings.ENVIRONMENT,
|
||||
"git_sha": git_sha[:8] if len(git_sha) > 8 else git_sha,
|
||||
"app_name": settings.APP_NAME,
|
||||
@@ -81,3 +81,39 @@ async def get_os_state(db: AsyncSession = Depends(get_db)):
|
||||
},
|
||||
"note": "This is a stub endpoint. Full OS state tracking coming in Phase 2.",
|
||||
}
|
||||
|
||||
|
||||
@router.get("/prism/config")
|
||||
async def prism_config(request: Request):
|
||||
"""Return Prism Console service configuration for health/status checks."""
|
||||
|
||||
def resolve_url(env_url: str, fallback: str) -> str:
|
||||
return env_url.rstrip("/") if env_url else fallback.rstrip("/")
|
||||
|
||||
base_url = str(request.base_url).rstrip("/")
|
||||
|
||||
services = [
|
||||
{
|
||||
"name": "core-api",
|
||||
"url": resolve_url(settings.PRISM_CORE_API_URL, base_url),
|
||||
"health_path": "/health",
|
||||
"version_path": "/version",
|
||||
},
|
||||
{
|
||||
"name": "public-api",
|
||||
"url": resolve_url(settings.PRISM_PUBLIC_API_URL, base_url),
|
||||
"health_path": "/health",
|
||||
"version_path": "/version",
|
||||
},
|
||||
{
|
||||
"name": "prism-console",
|
||||
"url": resolve_url(settings.PRISM_CONSOLE_URL, base_url),
|
||||
"health_path": "/prism/health",
|
||||
"version_path": "/version",
|
||||
},
|
||||
]
|
||||
|
||||
return {
|
||||
"environment": settings.ENVIRONMENT,
|
||||
"services": services,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user