Skip to content

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

@zwimer

Description

@zwimer

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'spathlib):

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions