add health endpoint for gateway and everos
This commit is contained in:
24
core/api.py
24
core/api.py
@ -66,6 +66,30 @@ def create_app(
|
||||
if not service.authenticate_user(user_id, user_key):
|
||||
raise HTTPException(status_code=401, detail="invalid user credentials")
|
||||
|
||||
@router.get("/health")
|
||||
async def health() -> dict[str, Any]:
|
||||
try:
|
||||
everos_health = await client.health_check()
|
||||
except Exception as exc:
|
||||
return {
|
||||
"status": "degraded",
|
||||
"api": {"status": "ok"},
|
||||
"everos": {
|
||||
"status": "unavailable",
|
||||
"base_url": cfg.everos_base_url,
|
||||
"error": str(exc),
|
||||
},
|
||||
}
|
||||
return {
|
||||
"status": "ok",
|
||||
"api": {"status": "ok"},
|
||||
"everos": {
|
||||
"status": "ok",
|
||||
"base_url": cfg.everos_base_url,
|
||||
"data": everos_health,
|
||||
},
|
||||
}
|
||||
|
||||
@router.post("/users")
|
||||
async def create_user(request: UserCreateRequest) -> dict[str, Any]:
|
||||
return service.create_user(request.user_id)
|
||||
|
||||
Reference in New Issue
Block a user