add endpoint to config
This commit is contained in:
parent
c339c505ad
commit
cb55318b91
2 changed files with 2 additions and 3 deletions
|
@ -15,6 +15,7 @@ class Config:
|
||||||
alert_rooms: list[str]
|
alert_rooms: list[str]
|
||||||
port: int = 8000
|
port: int = 8000
|
||||||
host: str = "127.0.0.1"
|
host: str = "127.0.0.1"
|
||||||
|
endpoint: str = "/webhook"
|
||||||
tls: bool = False
|
tls: bool = False
|
||||||
tls_auth: bool = False
|
tls_auth: bool = False
|
||||||
tls_crt: Optional[str] = None
|
tls_crt: Optional[str] = None
|
||||||
|
|
|
@ -12,8 +12,6 @@ from typing import (
|
||||||
)
|
)
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
ENDPOINT = "/webhook"
|
|
||||||
|
|
||||||
async def run_webhook(
|
async def run_webhook(
|
||||||
alert_queue: asyncio.Queue[dict[str, Any]],
|
alert_queue: asyncio.Queue[dict[str, Any]],
|
||||||
config: Config
|
config: Config
|
||||||
|
@ -28,7 +26,7 @@ async def run_webhook(
|
||||||
return aiohttp.web.Response()
|
return aiohttp.web.Response()
|
||||||
|
|
||||||
app = aiohttp.web.Application()
|
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)
|
runner = aiohttp.web.AppRunner(app)
|
||||||
await runner.setup()
|
await runner.setup()
|
||||||
site = aiohttp.web.TCPSite(runner, config.host, config.port)
|
site = aiohttp.web.TCPSite(runner, config.host, config.port)
|
||||||
|
|
Loading…
Reference in a new issue