feat(backend): add init option to backend config

When this option is set to `true`, the backend will automatically get
initialized during the backup process. This applies to invoking
`autorestic backup` or when `autorestic cron` actualy performs a backup.
This commit is contained in:
Boris Bera
2024-10-14 13:56:22 -04:00
parent 8108c52f50
commit 5ed1af31e0
4 changed files with 126 additions and 9 deletions

View File

@@ -38,3 +38,19 @@ backends:
```
With this setting, if a key is missing, `autorestic` will crash instead of generating a new key and updating your config file.
## Automatic Backend Initialization
`autorestic` is able to automatically initialize backends for you. This is done by setting `init: true` in the config for a given backend. For example:
```yaml | .autorestic.yml
backend:
foo:
type: ...
path: ...
init: true
```
When you set `init: true` on a backend config, `autorestic` will automatically initialize the underlying `restic` repository that powers the backend if it's not already initialized. In practice, this means that the backend will be initialized the first time it is being backed up to.
This option is helpful in cases where you want to automate the configuration of `autorestic`. This means that instead of running `autorestic exec init -b ...` manually when you create a new backend, you can let `autorestic` initialize it for you.