Recipes for managing repository environment variables

I usually deal with multiple repositories, and so my way of dealing with this is to create a script per repository, in /usr/local/sbin, and chmod 700.

#!/bin/sh

export RESTIC_REPOSITORY=...
export RESTIC_PASSWORD=...

exec restic "$@"

Then I can run restic-foo, restic-bar, etc. to operate on different repositories, without having to source any environment files. This also gives a centralized place to put options like --cache-dir.

1 Like