mirror of
https://github.com/bsedin/matrix-webhook.git
synced 2026-04-09 11:25:40 +00:00
Optionally serve hooks via a UNIX domain socket.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from signal import SIGINT, SIGTERM
|
||||
|
||||
from aiohttp import web
|
||||
@@ -27,9 +28,15 @@ async def main(event):
|
||||
runner = web.ServerRunner(server)
|
||||
await runner.setup()
|
||||
LOGGER.info(f"Binding on {conf.SERVER_ADDRESS=}")
|
||||
site = web.TCPSite(runner, *conf.SERVER_ADDRESS)
|
||||
if conf.SERVER_PATH:
|
||||
site = web.UnixSite(runner, conf.SERVER_PATH)
|
||||
else:
|
||||
site = web.TCPSite(runner, *conf.SERVER_ADDRESS)
|
||||
await site.start()
|
||||
|
||||
if conf.SERVER_PATH:
|
||||
os.chmod(conf.SERVER_PATH, 0o774)
|
||||
|
||||
# Run until we get a shutdown request
|
||||
await event.wait()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user