digint / digint/btrbk

[Feature Request] Support multiple config files: `btrbk -c /etc/btrbk.conf /etc/btrbk.override.conf`

Open
#635 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

It'd be nice to be able to have multiple config files. This could also be useful for those who ant to emulate drop-in override files (like `/etc/system/systmed/btrbk.d/override.conf` type override files, but for btrbk configs). Implementing this could be as simple as concatenating all config files together.

In practice, you could probably implement this as simple as the perl equivalent of (python using stdlib's`pathlib`):
```python3
config = "\n".join(k.read_text() for k in config_files)
```
Although, if possible, a merging of the configs would be preferred (unless this already happens when you define the same subvol multiple times in a config file?)

There are multiple reasons this could be nice, like temporary overrides. One particularly useful use-case for this is being able to successfully run partial backups when targets are not mounted.

For example, if I backup to the mounted drive `/mnt/external`, right now in the `systemd` unit I add `BindsTo=mnt-external.mount`. This works, but it means when `/mnt/external` is unmounted, snapshots are not taken. To solve this one could create two systemd btrbk services, one which uses a config with targets to `/mnt/external`, and one that is snapshot-only, running whichever is auto-selecting which based on the mount status. Unfortunately, that can be somewhat dangerous if the user fails to keep the two different configs in sync, if they ever edit one and forget to edit the other or typo in it, their backup system could fail silently, additionally this becomes ugly very quickly when you add another mountable target into the mix. Alternatively, if we had additional config files, the solution would be as simple choosing between `btrbk run -c /etc/btrbk.conf` vs and `btrbk run -c /etc/btrbk.conf -c /etc/btrbk.mnt-external.conf`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.