From f2bbc5fbc4570214b5d66098f1b600f243e6d66a Mon Sep 17 00:00:00 2001 From: donat Date: Wed, 19 Jul 2017 18:34:45 +0300 Subject: [PATCH] Set default value for password-file flag from env Allows defining password file path as RESTIC_PASSWORD_FILE=/foo --- src/cmds/restic/global.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmds/restic/global.go b/src/cmds/restic/global.go index 614bf3b9b..2a17379e8 100644 --- a/src/cmds/restic/global.go +++ b/src/cmds/restic/global.go @@ -67,7 +67,7 @@ func init() { f := cmdRoot.PersistentFlags() f.StringVarP(&globalOptions.Repo, "repo", "r", os.Getenv("RESTIC_REPOSITORY"), "repository to backup to or restore from (default: $RESTIC_REPOSITORY)") - f.StringVarP(&globalOptions.PasswordFile, "password-file", "p", "", "read the repository password from a 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.BoolVar(&globalOptions.NoLock, "no-lock", false, "do not lock the repo, this allows some operations on read-only repos") f.BoolVarP(&globalOptions.JSON, "json", "", false, "set output mode to JSON for commands that support it")