From d0e6ec5fbd927d60412fd9f5e8c63ac11e19d026 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Wed, 11 Dec 2024 13:40:15 +0100 Subject: [PATCH] Wrap generator config in a RuntimeConfig so that config.get(...) honours environment variable overrides --- requirements.txt | 2 +- src/config_generator/config_generator.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2bdac94..296b5e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ flask_login==0.6.3 jsonschema==4.20.0 psycopg2==2.9.9 -qwc-services-core==1.3.34 +qwc-services-core==1.3.35 requests==2.32.0 SQLAlchemy==2.0.29 Flask==3.0.0 diff --git a/src/config_generator/config_generator.py b/src/config_generator/config_generator.py index cc72413..205d32d 100644 --- a/src/config_generator/config_generator.py +++ b/src/config_generator/config_generator.py @@ -15,6 +15,7 @@ from qwc_services_core.config_models import ConfigModels from qwc_services_core.database import DatabaseEngine +from qwc_services_core.runtime_config import RuntimeConfig from .theme_reader import ThemeReader from .data_service_config import DataServiceConfig from .ext_service_config import ExtServiceConfig @@ -194,8 +195,9 @@ def __init__(self, config, logger, config_file_dir, use_cached_project_metadata, self.config = config - # get default QGIS server URL from ConfigGenerator config - generator_config = self.config.get('config', {}) + # Note: Wrap generator config in a RuntimeConfig so that config.get(...) honours environment variable overrides + generator_config = RuntimeConfig("configGenerator", self.logger).set_config(config) + self.default_qgis_server_url = generator_config.get( 'default_qgis_server_url', 'http://localhost:8001/ows/' ).rstrip('/') + '/'