From 98ef275aa117e51c361bc240e90f3705451f14f0 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Wed, 29 Mar 2023 10:53:31 +0100 Subject: [PATCH] feat(chalice): changed health-check behaviour --- api/routers/subs/health.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/api/routers/subs/health.py b/api/routers/subs/health.py index 2a1588a34..fdef52509 100644 --- a/api/routers/subs/health.py +++ b/api/routers/subs/health.py @@ -5,14 +5,16 @@ from routers.base import get_routers public_app, app, app_apikey = get_routers() -health_router = public_app -if tenants.tenants_exists(use_pool=False): - health_router = app - - -@health_router.get('/health', tags=["health-check"]) +@app.get('/health', tags=["health-check"]) def get_global_health_status(): - if tenants.tenants_exists(): - raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"Not Found") return {"data": health.get_health()} + + +if not tenants.tenants_exists(use_pool=False): + @public_app.get('/health', tags=["health-check"]) + def get_public_health_status(): + if tenants.tenants_exists(): + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"Not Found") + + return get_global_health_status()