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