add health endpoint

master
histausse 3 years ago
parent d89c0a2626
commit f8258117f4
Signed by: histausse
GPG Key ID: 67486F107F62E9E9

@ -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

Loading…
Cancel
Save