setup the structure to use ssl
This commit is contained in:
parent
cb55318b91
commit
d89c0a2626
1 changed files with 8 additions and 1 deletions
|
@ -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…
Reference in a new issue