The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::BorgRestore::Settings - Settings package

DESCRIPTION

App::BorgRestore::Settings searches for configuration files in the following locations in order. The first file found will be used, any later ones are ignored. If no files are found, defaults are used.

  • $XDG_CONFIG_HOME/borg-restore.cfg

  • /etc/borg-restore.cfg

Configuration Options

You can set the following options in the config file.

Note that the configuration file is parsed as a perl script. Thus you can also use any features available in perl itself.

Also note that it is important that the last statement of the file is positive because it is used to check that running the config went well. You can simply use "1;" on the last line as shown in the example config.

$borg_repo

This specifies the URL to the borg repo as used in other borg commands. If you use the $BORG_REPO environment variable set this to an empty string. Default: "backup:borg-".hostname;

$cache_path_base

This defaults to "$XDG_CACHE_HOME/borg-restore.pl". It contains the lookup database.

@backup_prefixes

This is an array of prefixes that need to be added or removed when looking up a file in the backup archives. If you use filesystem snapshots and the snapshot for /home is located at /mnt/snapshots/home, you have to add the following:

# In the backup archives, /home has the path /mnt/snapshots/home {regex => "^/home/", replacement => "mnt/snapshots/home/"},

The regex must always include the leading slash and it is suggested to include a tailing slash as well to prevent clashes with directories that start with the same string. The first regex that matches for a given file is used. This setting only affects lookups, it does not affect the creation of the database with --update-database.

If you create a backup of /home/user only, you will need to use the following:

# In the backup archives, /home/user/foo has the path foo {regex => "^/home/user", replacement => ""},

$sqlite_cache_size

Default: 102400

The size of the in-memory cache of sqlite in kibibytes. This should be large enough to fit the database so that adding new backup data does not need to use the disk too much.

Example Configuration

 $borg_repo = "/path/to/repo";
 $cache_path_base = "/mnt/somewhere/borg-restore.pl-cache";
 @backup_prefixes = (
        {regex => "^/home/", replacement => "mnt/snapshots/home/"},
        # /boot is not snapshotted
        {regex => "^/boot/", replacement => "boot"},
        {regex => "^/", replacement => "mnt/snapshots/root/"},
 );
 $sqlite_cache_size = 2097152;

 1; #ensure positive return value

LICENSE

Copyright (C) 2016-2017 Florian Pritz <bluewind@xinu.at>

Licensed under the GNU General Public License version 3 or later. See LICENSE for the full license text.