From cb55318b91ffc5936982cdbedb9d5ae3a5609810 Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Thu, 7 Oct 2021 17:12:06 +0200 Subject: [PATCH] add endpoint to config --- src/kassandra/config.py | 1 + src/kassandra/webhook.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/kassandra/config.py b/src/kassandra/config.py index c0e5d78..0d4ff91 100644 --- a/src/kassandra/config.py +++ b/src/kassandra/config.py @@ -15,6 +15,7 @@ class Config: alert_rooms: list[str] port: int = 8000 host: str = "127.0.0.1" + endpoint: str = "/webhook" tls: bool = False tls_auth: bool = False tls_crt: Optional[str] = None diff --git a/src/kassandra/webhook.py b/src/kassandra/webhook.py index 7a91237..efa71ac 100644 --- a/src/kassandra/webhook.py +++ b/src/kassandra/webhook.py @@ -12,8 +12,6 @@ from typing import ( ) from .config import Config -ENDPOINT = "/webhook" - async def run_webhook( alert_queue: asyncio.Queue[dict[str, Any]], config: Config @@ -28,7 +26,7 @@ async def run_webhook( return aiohttp.web.Response() app = aiohttp.web.Application() - app.add_routes([aiohttp.web.post(ENDPOINT, handler)]) + app.add_routes([aiohttp.web.post(config.endpoint, handler)]) runner = aiohttp.web.AppRunner(app) await runner.setup() site = aiohttp.web.TCPSite(runner, config.host, config.port)