X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/28c98584c1f8bed4aa2c2fc22956f7a0f5fc8f3b..381aecb95231afa04dd41da7ece3533aa525c3fa:/nominatim/config.py?ds=sidebyside diff --git a/nominatim/config.py b/nominatim/config.py index 5d56d024..f316280b 100644 --- a/nominatim/config.py +++ b/nominatim/config.py @@ -12,6 +12,27 @@ from nominatim.errors import UsageError LOG = logging.getLogger() + +def flatten_config_list(content, section=''): + """ Flatten YAML configuration lists that contain include sections + which are lists themselves. + """ + if not content: + return [] + + if not isinstance(content, list): + raise UsageError(f"List expected in section '{section}'.") + + output = [] + for ele in content: + if isinstance(ele, list): + output.extend(flatten_config_list(ele, section)) + else: + output.append(ele) + + return output + + class Configuration: """ Load and manage the project configuration. @@ -172,7 +193,7 @@ class Configuration: search_paths = [self.project_dir, self.config_dir] for path in search_paths: - if (path / filename).is_file(): + if path is not None and (path / filename).is_file(): return path / filename LOG.fatal("Configuration file '%s' not found.\nDirectories searched: %s",