add endpoint to config

This commit is contained in:
histausse 2021-10-07 17:12:06 +02:00
parent c339c505ad
commit cb55318b91
Signed by: histausse
GPG key ID: 67486F107F62E9E9
2 changed files with 2 additions and 3 deletions

View file

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

View file

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