add endpoint to config

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

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

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

Loading…
Cancel
Save