mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 16:26:25 +00:00
ensure config is loaded before lock
This commit is contained in:
parent
26de4385ea
commit
252968e15e
60
CHANGELOG.md
60
CHANGELOG.md
@ -11,23 +11,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- use official docker image instead of installing rclone every time docker is used.
|
- use official docker image instead of installing rclone every time docker is used.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- lock file not always next to the config file.
|
||||||
|
|
||||||
## [1.5.0] - 2021-11-20
|
## [1.5.0] - 2021-11-20
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Support for multiple paths
|
- Support for multiple paths.
|
||||||
- Improved error handling
|
- Improved error handling.
|
||||||
- Allow for specific snapshot to be restored
|
- Allow for specific snapshot to be restored.
|
||||||
- Docker image
|
- Docker image.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- rclone in docker volumes
|
- rclone in docker volumes.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- [Breaking Change] Declaration of docker volumes. See: https://autorestic.vercel.app/migration/1.4_1.5
|
- [Breaking Change] Declaration of docker volumes. See: https://autorestic.vercel.app/migration/1.4_1.5.
|
||||||
- [Breaking Change] Hooks default executing directory now defaults to the config file directory. See: https://autorestic.vercel.app/migration/1.4_1.5
|
- [Breaking Change] Hooks default executing directory now defaults to the config file directory. See: https://autorestic.vercel.app/migration/1.4_1.5.
|
||||||
|
|
||||||
## [1.4.1] - 2021-10-31
|
## [1.4.1] - 2021-10-31
|
||||||
|
|
||||||
@ -39,26 +43,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Allow specify to specify a backend for location backup
|
- Allow specify to specify a backend for location backup.
|
||||||
- Global restic flags
|
- Global restic flags.
|
||||||
- Generic ENV support for backends
|
- Generic ENV support for backends.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Install now only requires `wget`
|
- Install now only requires `wget`.
|
||||||
- Env variable for the `KEY` has been renamed from `AUTORESTIC_[BACKEND NAME]_KEY` -> `AUTORESTIC_[BACKEND NAME]_RESTIC_PASSWORD`
|
- Env variable for the `KEY` has been renamed from `AUTORESTIC_[BACKEND NAME]_KEY` -> `AUTORESTIC_[BACKEND NAME]_RESTIC_PASSWORD`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Error handling during upgrade & uninstall
|
- Error handling during upgrade & uninstall.
|
||||||
|
|
||||||
## [1.3.0] - 2021-10-26
|
## [1.3.0] - 2021-10-26
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Pass restic backup metadata as ENV to hooks
|
- Pass restic backup metadata as ENV to hooks.
|
||||||
- Support for `XDG_CONFIG_HOME` and `${HOME}/.config` as default locations for `.autorestic.yaml` file.
|
- Support for `XDG_CONFIG_HOME` and `${HOME}/.config` as default locations for `.autorestic.yaml` file.
|
||||||
- Binary restic flags are now supported
|
- Binary restic flags are now supported.
|
||||||
- Pass encryption keys from env variables or files.
|
- Pass encryption keys from env variables or files.
|
||||||
|
|
||||||
## [1.2.0] - 2021-08-05
|
## [1.2.0] - 2021-08-05
|
||||||
@ -66,12 +70,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Community page
|
- Community page
|
||||||
- Support for yaml references and aliases
|
- Support for yaml references and aliases.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Better verbose output for hooks
|
- Better verbose output for hooks.
|
||||||
- Better error message for bad formatted configs
|
- Better error message for bad formatted configs.
|
||||||
|
|
||||||
## [1.1.2] - 2021-07-11
|
## [1.1.2] - 2021-07-11
|
||||||
|
|
||||||
@ -83,24 +87,24 @@ Don't check all backend when running `forget` or `exec` commands.
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Options for backends
|
- Options for backends.
|
||||||
|
|
||||||
## [1.1.0] - 2021-05-06
|
## [1.1.0] - 2021-05-06
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- use custom restic binary
|
- use custom restic binary.
|
||||||
- success & failure hooks
|
- success & failure hooks.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- don't skip other locations on failure
|
- don't skip other locations on failure.
|
||||||
|
|
||||||
## [1.0.9] - 2021-05-01
|
## [1.0.9] - 2021-05-01
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Validation for docker volumes
|
- Validation for docker volumes.
|
||||||
|
|
||||||
## [1.0.8] - 2021-04-28
|
## [1.0.8] - 2021-04-28
|
||||||
|
|
||||||
@ -123,7 +127,7 @@ Don't check all backend when running `forget` or `exec` commands.
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Support for rclone
|
- Support for rclone.
|
||||||
|
|
||||||
## [1.0.5] - 2021-04-24
|
## [1.0.5] - 2021-04-24
|
||||||
|
|
||||||
@ -136,17 +140,17 @@ Don't check all backend when running `forget` or `exec` commands.
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Options to add rest username and password in config
|
- Options to add rest username and password in config.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Don't add empty strings when saving config
|
- Don't add empty strings when saving config.
|
||||||
|
|
||||||
## [1.0.3] - 2021-04-20
|
## [1.0.3] - 2021-04-20
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Auto upgrade script was not working on linux as linux does not support writing to the binary that is being executed
|
- Auto upgrade script was not working on linux as linux does not support writing to the binary that is being executed.
|
||||||
|
|
||||||
## [1.0.2] - 2021-04-20
|
## [1.0.2] - 2021-04-20
|
||||||
|
|
||||||
@ -162,7 +166,7 @@ Don't check all backend when running `forget` or `exec` commands.
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Completion command for various shells
|
- Completion command for various shells.
|
||||||
|
|
||||||
## [1.0.0] - 2021-04-17
|
## [1.0.0] - 2021-04-17
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ var checkCmd = &cobra.Command{
|
|||||||
Use: "check",
|
Use: "check",
|
||||||
Short: "Check if everything is setup",
|
Short: "Check if everything is setup",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
internal.GetConfig()
|
||||||
err := lock.Lock()
|
err := lock.Lock()
|
||||||
CheckErr(err)
|
CheckErr(err)
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
@ -11,6 +11,7 @@ var cronCmd = &cobra.Command{
|
|||||||
Short: "Run cron job for automated backups",
|
Short: "Run cron job for automated backups",
|
||||||
Long: `Intended to be mainly triggered by an automated system like systemd or crontab. For each location checks if a cron backup is due and runs it.`,
|
Long: `Intended to be mainly triggered by an automated system like systemd or crontab. For each location checks if a cron backup is due and runs it.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
internal.GetConfig()
|
||||||
internal.CRON_LEAN, _ = cmd.Flags().GetBool("lean")
|
internal.CRON_LEAN, _ = cmd.Flags().GetBool("lean")
|
||||||
err := lock.Lock()
|
err := lock.Lock()
|
||||||
CheckErr(err)
|
CheckErr(err)
|
||||||
|
@ -13,6 +13,7 @@ var restoreCmd = &cobra.Command{
|
|||||||
Short: "Restore backup for location",
|
Short: "Restore backup for location",
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
internal.GetConfig()
|
||||||
err := lock.Lock()
|
err := lock.Lock()
|
||||||
CheckErr(err)
|
CheckErr(err)
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
@ -19,8 +19,14 @@ func getLock() *viper.Viper {
|
|||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
lock = viper.New()
|
lock = viper.New()
|
||||||
lock.SetDefault("running", false)
|
lock.SetDefault("running", false)
|
||||||
p := path.Dir(viper.ConfigFileUsed())
|
p := viper.ConfigFileUsed()
|
||||||
file = path.Join(p, ".autorestic.lock.yml")
|
colors.Primary.Println(p)
|
||||||
|
if p == "" {
|
||||||
|
colors.Error.Println("cannot lock before reading config location")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
file = path.Join(path.Dir(p), ".autorestic.lock.yml")
|
||||||
|
colors.Faint.Println("Using lock:\t", file)
|
||||||
lock.SetConfigFile(file)
|
lock.SetConfigFile(file)
|
||||||
lock.SetConfigType("yml")
|
lock.SetConfigType("yml")
|
||||||
lock.ReadInConfig()
|
lock.ReadInConfig()
|
||||||
|
Loading…
Reference in New Issue
Block a user