setup the structure to use ssl

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

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

Loading…
Cancel
Save