Support custom variables in borgmatic config files #472
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#472
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I have several config files for borgmatic set up that all backup to the same repository. The reason to have them all back up to the same repository is the awesome deduplication feature of borg. The reason to use several config files instead of one is to e.g. use different retention policies.
Imagine e.g. the following config files:
Config pictures
Config some_folder
Now, for only 2 configs this is still fairly easy but having more configs, it would be really nice if one could even shorten these configs. So if borgmatic would support (some) custom variables, the 2 config files could be simplified even further:
Config pictures
Config some_folder
Now, the archive_name_format, the prefixes and the hooks are exactly the same in both files and can thus be moved into the include files and one would end up with something like:
Config pictures
Config some_folder
I figured out that
{configuration_filename}
is not only supported in the on error hook but also in the other hooks. So a way to at least unify the hooks for all the backups is:I have not yet checked if this would also work for the prefixes.
Sorry for the delay here. This is a pretty interesting idea! I'll have to think about how this would work given that the interpolation would (presumably) have to work for all values and not just within hooks like the existing borgmatic variable interpolation.
Anyway, I wanted to mention that with #381 now implemented in master, you will be able to simplify configuration like the following:
... to something more like this:
That wouldn't support the custom variables described in this ticket (yet), but it would at minimum cut down on some of the boilerplate repeated in each configuration file.
Thanks for the hint and for implementing #381. This is indeed already a very big step. If that possibility existed when I was writing my config files, I wouldn't have opened this ticket. :)
Glad to hear it might be useful. Now that #381 is released, do you still have the need for custom variables? Either way, I just wanted to confirm. Thanks!
Thanks for getting back to me. I think there would be an advantage fo also having the variables but to be honest it is now rather small. So I'm totally happy with what you have done.
Okay, I'll close this for now. But if the need for the feature increases or anyone else has the same use case, please feel free to reopen!