diff --git a/cmd/restic/global.go b/cmd/restic/global.go index d333f9ee3..01d183e7e 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -43,7 +43,6 @@ var version = "compiled manually" type GlobalOptions struct { config.Config - PasswordFile string Quiet bool Verbose int NoLock bool @@ -91,8 +90,8 @@ func init() { // these fields are embedded in config.Config and queried via f.Get[...]() f.StringP("repo", "r", "", "repository to backup to or restore from (default: $RESTIC_REPOSITORY)") + f.StringP("password-file", "p", "", "read the repository password from a file (default: $RESTIC_PASSWORD_FILE)") - f.StringVarP(&globalOptions.PasswordFile, "password-file", "p", os.Getenv("RESTIC_PASSWORD_FILE"), "read the repository password from a file (default: $RESTIC_PASSWORD_FILE)") f.BoolVarP(&globalOptions.Quiet, "quiet", "q", false, "do not output comprehensive progress report") f.CountVarP(&globalOptions.Verbose, "verbose", "v", "be verbose (specify --verbose multiple times or level `n`)") f.BoolVar(&globalOptions.NoLock, "no-lock", false, "do not lock the repo, this allows some operations on read-only repos") diff --git a/internal/ui/config/config.go b/internal/ui/config/config.go index aadff4670..91023b61a 100644 --- a/internal/ui/config/config.go +++ b/internal/ui/config/config.go @@ -15,9 +15,9 @@ import ( // Config contains configuration items read from a file. type Config struct { - Repo string `config:"repo" flag:"repo" env:"RESTIC_REPOSITORY"` - Password string `config:"password" env:"RESTIC_PASSWORD"` - PasswordFile string `config:` + Repo string `config:"repo" flag:"repo" env:"RESTIC_REPOSITORY"` + Password string `config:"password" env:"RESTIC_PASSWORD"` + PasswordFile string `config:"password_file" flag:"password-file" env:"RESTIC_PASSWORD_FILE"` Backends map[string]Backend `config:"backend"` Backup *Backup `config:"backup"`