From 1bcabc389852618d49064c5fbedf9a6c9cc861f7 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 30 Apr 2024 00:03:47 +1200 Subject: [PATCH] support different config files for separate instances --- web.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web.py b/web.py index 406f677..1480e0c 100644 --- a/web.py +++ b/web.py @@ -15,13 +15,13 @@ import base64 class ReticulumWebChat: - def __init__(self, identity: RNS.Identity): + def __init__(self, webchat_config_file, identity: RNS.Identity): # default values before loading config self.display_name = "Anonymous Peer" # load config - self.config_file = "storage/config.json" + self.config_file = webchat_config_file or "storage/config.json" self.load_config() # init reticulum @@ -336,6 +336,7 @@ async def main(): parser.add_argument("--port", nargs='?', default="8000", type=int, help="The port the web server should listen on.") parser.add_argument("--identity-file", type=str, help="Path to a Reticulum Identity file to use as your LXMF address.") parser.add_argument("--identity-base64", type=str, help="A base64 encoded Reticulum Identity to use as your LXMF address.") + parser.add_argument("--webchat-config-file", type=str, help="Path to a ReticulumWebChat config file for saving user preferences.") args = parser.parse_args() # use provided identity, or fallback to a random one @@ -355,7 +356,7 @@ async def main(): print(identity) # init app - reticulum_webchat = ReticulumWebChat(identity) + reticulum_webchat = ReticulumWebChat(args.webchat_config_file, identity) await reticulum_webchat.run(args.host, args.port)