From aec088f2a36c83c7a5d715981295ad9c43c50707 Mon Sep 17 00:00:00 2001 From: filak Date: Thu, 25 Jan 2024 16:12:25 +0100 Subject: [PATCH] Version 1.6.3 --- flask-app/application/main.py | 2 +- flask-app/application/modules/utils.py | 7 ++++--- flask-app/application/worker.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flask-app/application/main.py b/flask-app/application/main.py index bbc7e59..c21c1c2 100644 --- a/flask-app/application/main.py +++ b/flask-app/application/main.py @@ -85,7 +85,7 @@ def create_app(debug=False, logger=None, port=5900, app.app_context().push() ### Or use: with app.app_context(): - adminConfig = mtu.getConfig(app.config['admin_config_file']) + adminConfig = mtu.getConfig(app.config['admin_config_file'], admin=True) if not adminConfig: return diff --git a/flask-app/application/modules/utils.py b/flask-app/application/modules/utils.py index 29d3fd2..bfdc714 100644 --- a/flask-app/application/modules/utils.py +++ b/flask-app/application/modules/utils.py @@ -43,13 +43,14 @@ def get_instance_dir(app, file_path): ### Config loading -def getConfig(cfg_file): +def getConfig(cfg_file, admin=False): cpath = Path( cfg_file ) if not cpath.is_file(): - error = 'Missing Admin config file : '+ str(cfg_file) + error = 'Missing config file : '+ str(cfg_file) app.logger.error(error) print('ERROR: '+error) - print('Run the set-mtw-admin tool !') + if admin: + print('Run the set-mtw-admin tool !') return try: config = configparser.ConfigParser() diff --git a/flask-app/application/worker.py b/flask-app/application/worker.py index d6f4b0f..1047ebf 100644 --- a/flask-app/application/worker.py +++ b/flask-app/application/worker.py @@ -48,7 +48,7 @@ def create_app(debug=False, logger=None, port=5903, admin_config_file = mtu.get_instance_dir(app, 'conf/mtw-admin.tmp') )) - adminConfig = mtu.getConfig(app.config['admin_config_file']) + adminConfig = mtu.getConfig(app.config['admin_config_file'], admin=True) if not adminConfig: return