runrestic
runrestic copied to clipboard
Add "includes" in config file
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 https://github.com/sinnwerkstatt/runrestic/blob/762273951f8fd7b918b917293d0fa94fc0b34969/runrestic/runrestic/runrestic.py#L65 with
parsed_cfg = parse_configuration(c, CONFIG_DEFAULTS)
for include in reversed(config['includes']):
parsed_cfg = parse_configuration(include, parsed_cfg)
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.