Inherit common configuration
What I'm trying to do and why
I have a bunch of different applications to backup, each with slightly different options. But they have many options in common, and I don't want to repeat those options for each application.
I could use the existing include merging feature, but that results in an awkward configuration files where you have to do multiple includes, one per section.
It would be great if there was a more supported way to inherit and reuse common configuration options across the entire configuration file.
Other notes / implementation ideas
One idea is to update the existing include merging feature to do "deep merging". That might look something like this:
location: ... retention: keep_daily: 1 keep_hourly: 2
<<: !include /etc/borgmatic/common.yaml retention: keep_daily: 5
This would perform a deep merge of all sections including the retention section, such that the resulting interpreted option values would be a
5 and a
If you tried this today with a current borgmatic version, the entire
retention section in
/etc/borgmatic.d/myapp.yaml would replace the entire
retention section from the common file—not what the user wants under this use case.
Note that if this deep merging change were made, it would technically be a breaking change to the existing include merging behavior.
Implemented in master! Now you can do this:
<<: !include /etc/borgmatic/common.yaml location: ... retention: keep_daily: 5
retention: keep_hourly: 24 keep_daily: 7
And it'll do the right thing and produce a
keep_hourly value of
24 and an overridden
keep_daily value of
Deleting a branch is permanent. It CANNOT be undone. Continue?