support setting host and port via cli args

This commit is contained in:
liamcottle
2024-04-29 15:16:44 +12:00
parent 1429ba50a8
commit 254177e630
2 changed files with 12 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ python web.py
## TODO
- [ ] allow passing in a custom port to serve on via cli args
- [ ] don't start Reticulum before cli args have been parsed
- [ ] allow passing in a custom Reticulum config file via cli args
- [ ] conversations/contacts list ui with unread indicators
- [ ] create/import/export identities in the web ui

12
web.py
View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python
import argparse
import json
import RNS
@@ -32,8 +33,17 @@ websocket_clients = []
async def main():
# parse command line args
parser = argparse.ArgumentParser(description="ReticulumWebChat")
parser.add_argument("--host", nargs='?', default="0.0.0.0", type=str)
parser.add_argument("--port", nargs='?', default="8000", type=int)
args = parser.parse_args()
# run sanic app
app.run()
app.run(
host=args.host,
port=args.port,
)
# set a callback for when an lxmf message is received
message_router.register_delivery_callback(lxmf_delivery)