diff --git a/src/kassandra/webhook.py b/src/kassandra/webhook.py index efa71ac..d0c70c4 100644 --- a/src/kassandra/webhook.py +++ b/src/kassandra/webhook.py @@ -5,6 +5,7 @@ The webhook receiving the alerts from alertmanager. import asyncio import aiohttp.web import aiohttp.web_request +import ssl from typing import ( Any, @@ -12,6 +13,9 @@ from typing import ( ) from .config import Config +def load_ssl_context(config:Config)->ssl.SSLContext: + pass + async def run_webhook( alert_queue: asyncio.Queue[dict[str, Any]], config: Config @@ -29,5 +33,8 @@ async def run_webhook( 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) + ssl_context = None + if config.tls: + ssl_context = load_ssl_context(config) + site = aiohttp.web.TCPSite(runner, config.host, config.port, ssl_context=ssl_context) await site.start()