fix NameErrors
This commit is contained in:
parent
6cf9d75c81
commit
9a1061e5fc
|
@ -118,15 +118,16 @@ async def amain():
|
|||
runner = web.ServerRunner(srv)
|
||||
await runner.setup()
|
||||
bind = os.path.expandvars(config['bind'])
|
||||
if (unix := '/' in bind):
|
||||
if (bind_unix := '/' in bind):
|
||||
site = web.UnixSite(runner, bind)
|
||||
else:
|
||||
site = web.TCPSite(runner, host=bind, port=(port := config.get('port', 8080)))
|
||||
|
||||
async with aiohttp.ClientSession() as http_:
|
||||
http.set(http_)
|
||||
await site.start()
|
||||
print('Listening on', bind if unix else f'{bind}:{port}', end='...\n')
|
||||
if '/' in bind:
|
||||
print('Listening on', bind if bind_unix else f'{bind}:{port}', end='...\n')
|
||||
if bind_unix:
|
||||
with contextlib.suppress(KeyError):
|
||||
os.chmod(bind, config.get('socket_mod', 0o775))
|
||||
await asyncio.sleep(float('inf'))
|
||||
|
|
Loading…
Reference in New Issue