From 557d89429f7b8d54026a517b3721f3e8eadcce56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?x=C4=B1=CA=83=C7=9D=C9=9F?= Date: Fri, 13 Dec 2024 14:02:26 +0100 Subject: [PATCH] Added simple healthz endpoint. (#117) --- runtimes/eoapi/stac/eoapi/stac/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtimes/eoapi/stac/eoapi/stac/app.py b/runtimes/eoapi/stac/eoapi/stac/app.py index 2f42296..df5fc59 100644 --- a/runtimes/eoapi/stac/eoapi/stac/app.py +++ b/runtimes/eoapi/stac/eoapi/stac/app.py @@ -31,7 +31,7 @@ from starlette.middleware import Middleware from starlette.middleware.cors import CORSMiddleware from starlette.requests import Request -from starlette.responses import HTMLResponse +from starlette.responses import HTMLResponse, JSONResponse from starlette.templating import Jinja2Templates from starlette_cramjam.middleware import CompressionMiddleware @@ -164,6 +164,9 @@ async def viewer_page(request: Request): media_type="text/html", ) +@app.get("/healthz", response_class=JSONResponse) +async def healthz_page(request: Request): + return JSONResponse({'ping': 'pong!'}) if auth_settings.openid_configuration_url: oidc_auth = OpenIdConnectAuth.from_settings(auth_settings)