Fix health check: return 200 when server running, include API status in body
All checks were successful
Build and Push Outline MCP Docker Image / build (push) Successful in 6s

This commit is contained in:
Ben
2025-12-30 20:41:20 +00:00
parent cf1d9be24b
commit fcf13b91fa

View File

@@ -520,20 +520,23 @@ def get_api_reference() -> str:
# --- Health Check Endpoint --- # --- Health Check Endpoint ---
async def health(request): async def health(request):
"""Health check endpoint for Docker/load balancer.""" """Health check endpoint for Docker/load balancer.
if not OUTLINE_API_URL or not OUTLINE_API_TOKEN:
return JSONResponse(
{
"status": "degraded",
"error": "Missing OUTLINE_API_URL or OUTLINE_API_TOKEN",
},
status_code=503,
)
healthy, message = await outline_client.check_health() Returns 200 if server is running. API connectivity status is included
if healthy: in response body but doesn't affect HTTP status code.
return JSONResponse({"status": "ok"}) """
return JSONResponse({"status": "degraded", "error": message}, status_code=503) response = {"status": "ok", "server": "running"}
if not OUTLINE_API_URL or not OUTLINE_API_TOKEN:
response["api"] = "not_configured"
response["detail"] = "Missing OUTLINE_API_URL or OUTLINE_API_TOKEN"
else:
healthy, message = await outline_client.check_health()
response["api"] = "connected" if healthy else "disconnected"
if not healthy:
response["detail"] = message
return JSONResponse(response)
# --- ASGI Application --- # --- ASGI Application ---