From 4653b5b4259ddf9a52176f79a55953b2a623aeac Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Fri, 7 Jul 2023 13:19:20 +0200 Subject: [PATCH] feat: app config support --- server.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.py b/server.py index c519b58..ef378fd 100755 --- a/server.py +++ b/server.py @@ -297,6 +297,16 @@ def create_app(): app.config["SECRET_KEY"] = secrets.token_urlsafe(64) + # load app config # + config_dir = app.config["JSON_CONFIG_DIR"] + main_config_file = "./{}/config.json".format(config_dir) + print(main_config_file) + if os.path.isfile(main_config_file): + with open(main_config_file) as config_file: + config_data = json.load(config_file) + app.config |= config_data + print(config_data) + if os.path.isfile(app.config["JSON_CONFIG_FILE"]): with open(app.config["JSON_CONFIG_FILE"]) as f: config |= json.load(f)