add health endpoint
This commit is contained in:
parent
d89c0a2626
commit
f8258117f4
1 changed files with 8 additions and 2 deletions
|
@ -24,13 +24,19 @@ async def run_webhook(
|
||||||
Run the webhook endpoint and put the alerts in the queue.
|
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()
|
alert = await request.json()
|
||||||
await alert_queue.put(alert)
|
await alert_queue.put(alert)
|
||||||
return aiohttp.web.Response()
|
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 = 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)
|
runner = aiohttp.web.AppRunner(app)
|
||||||
await runner.setup()
|
await runner.setup()
|
||||||
ssl_context = None
|
ssl_context = None
|
||||||
|
|
Loading…
Reference in a new issue