mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Allow binding more that one address.
This commit is contained in:
2
main.py
2
main.py
@@ -27,7 +27,7 @@ async def main(args):
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser('meshview')
|
||||
parser.add_argument('--bind', default='::1')
|
||||
parser.add_argument('--bind', nargs='*', default='::1')
|
||||
parser.add_argument('--acme-challenge')
|
||||
parser.add_argument('--port', default=8080, type=int)
|
||||
parser.add_argument('--tls-cert')
|
||||
|
||||
@@ -18,5 +18,6 @@ async def run_server(bind, path):
|
||||
)
|
||||
runner = web.AppRunner(app)
|
||||
await runner.setup()
|
||||
site = web.TCPSite(runner, bind, 80)
|
||||
for host in bind:
|
||||
site = web.TCPSite(runner, host, 80)
|
||||
await site.start()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
from aiohttp_sse import sse_response
|
||||
@@ -395,8 +396,9 @@ async def run_server(bind, port, tls_cert):
|
||||
ssl_context.load_cert_chain(tls_cert)
|
||||
else:
|
||||
ssl_context = None
|
||||
site = web.TCPSite(runner, bind, port, ssl_context=ssl_context)
|
||||
await site.start()
|
||||
for host in bind:
|
||||
site = web.TCPSite(runner, host, port, ssl_context=ssl_context)
|
||||
await site.start()
|
||||
|
||||
while True:
|
||||
await asyncio.sleep(3600) # sleep forever
|
||||
|
||||
Reference in New Issue
Block a user