Add "includes" in config file
darkdragon-001 opened this issue · 1 comments
darkdragon-001 commented
Allow including other files.
Modify parse_configuration()
to get a base config as parameter:
-def parse_configuration(config_filename: str) -> Dict[str, Any]:
+def parse_configuration(config_filename: str, config_base: Dict[str, Any]) -> Dict[str, Any]:
logger.debug(f"Parsing configuration file: {config_filename}")
with open(config_filename) as file:
config = toml.load(file)
- config = deep_update(config_base, dict(config))
+ config = deep_update(CONFIG_DEFAULTS, dict(config))
if "name" not in config:
config["name"] = os.path.basename(config_filename)
jsonschema.validate(instance=config, schema=SCHEMA)
return config
Replace
withparsed_cfg = parse_configuration(c, CONFIG_DEFAULTS)
for include in reversed(config['includes']):
parsed_cfg = parse_configuration(include, parsed_cfg)
andreasnuesslein commented
as I said in other places: if you have a good reason for such a change and could provide a PR, I might merge it.