diff --git a/galaxy_ng/app/dynaconf_hooks.py b/galaxy_ng/app/dynaconf_hooks.py index 5f2218a0fd..ec7b6b553d 100755 --- a/galaxy_ng/app/dynaconf_hooks.py +++ b/galaxy_ng/app/dynaconf_hooks.py @@ -55,6 +55,7 @@ def post(settings: Dynaconf) -> Dict[str, Any]: data.update(configure_password_validators(settings)) data.update(configure_api_base_path(settings)) data.update(configure_legacy_roles(settings)) + data.update(configure_dab_required_settings(settings)) data.update(configure_resource_provider(settings)) # This should go last, and it needs to receive the data from the previous configuration @@ -750,3 +751,14 @@ def alter_hostname_settings( Action.AFTER_GET: hook_functions } } + + +def configure_dab_required_settings(settings: Dynaconf) -> Dict[str, Any]: + """Load all keys defined on dab dynamic_settings if not already defined.""" + data = {} + notset = object() + from ansible_base.lib.dynamic_config import dynamic_settings + for key in dir(dynamic_settings): + if key.isupper() and settings.get(key, notset) is notset: + data[key] = getattr(dynamic_settings, key) + return data diff --git a/galaxy_ng/tests/unit/test_settings.py b/galaxy_ng/tests/unit/test_settings.py new file mode 100644 index 0000000000..20e51cb277 --- /dev/null +++ b/galaxy_ng/tests/unit/test_settings.py @@ -0,0 +1,15 @@ +from django.test import TestCase +from django.conf import settings +from ansible_base.lib.dynamic_config import dynamic_settings + + +DAB_REQUIRED_SETTINGS = [key for key in dir(dynamic_settings) if key.isupper()] + + +class TestSetting(TestCase): + def test_dab_settings_are_loaded(self): + """Ensure all required settings from DAB are configured on Galaxy""" + notset = object() + for key in DAB_REQUIRED_SETTINGS: + key_on_galaxy = settings.get(key, notset) + self.assertIsNot(key_on_galaxy, notset)