Skip to content

Commit 8267c58

Browse files
committed
simpler
1 parent 908b9fe commit 8267c58

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

bedevere/__main__.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,8 @@ async def health_check(request):
7878
app.router.add_post("/", main)
7979
app.router.add_get("/health", health_check)
8080

81-
socket_path = os.environ.get("SOCKET_PATH")
82-
port = os.environ.get("PORT")
83-
84-
if socket_path:
85-
86-
async def run_with_socket():
87-
runner = web.AppRunner(app)
88-
await runner.setup()
89-
site = web.UnixSite(runner, path=socket_path)
90-
await site.start()
91-
await asyncio.Event().wait()
92-
93-
asyncio.run(run_with_socket())
81+
if os.path.isdir("/var/run/cabotage"):
82+
web.run_app(app, path="/var/run/cabotage/cabotage.sock")
9483
else:
95-
if port is not None:
96-
port = int(port)
97-
web.run_app(app, port=port)
84+
port = os.environ.get("PORT")
85+
web.run_app(app, port=int(port) if port else None)

0 commit comments

Comments
 (0)