diff --git a/src/kassandra/webhook.py b/src/kassandra/webhook.py index d0c70c4..1a6ef09 100644 --- a/src/kassandra/webhook.py +++ b/src/kassandra/webhook.py @@ -24,13 +24,19 @@ async def run_webhook( Run the webhook endpoint and put the alerts in the queue. """ - async def handler(request:aiohttp.web_request.Request): + async def handler(request:aiohttp.web_request.Request)->aiohttp.web.Response: alert = await request.json() await alert_queue.put(alert) return aiohttp.web.Response() + async def health(request:aiohttp.web_request.Request)->aiohttp.web.Response: + return aiohttp.web.Response(text="OK") + app = aiohttp.web.Application() - app.add_routes([aiohttp.web.post(config.endpoint, handler)]) + app.add_routes([ + aiohttp.web.post(config.endpoint, handler), + aiohttp.web.get("/health", health) + ]) runner = aiohttp.web.AppRunner(app) await runner.setup() ssl_context = None