Skip to content

Commit

Permalink
Fix getsops#671: updatekeys checks for config file flag (getsops#672)
Browse files Browse the repository at this point in the history
* update 'updatekeys' subcommand to use config (if exists) from commandline

* Fix getsops#671: `updatekeys` checks for config file flag

The 'updatekeys' subcommand did not check for the config flag
in the command line. Add that check and if found use it to set configPath.

* Fix getsops#671: `updatekeys` checks for config file flag

The 'updatekeys' subcommand did not check for the config global string flag.
 Add that check and if found use it to set configPath.

* Fix getsops#671: `updatekeys` checks for config file flag

The 'updatekeys' subcommand did not check for the config global string flag.
Add that check and if found use it to set configPath.

 Edit: Remove mistake file addition

* Update cmd/sops/main.go

Co-authored-by: Adrian Utrilla <adrianutrilla@gmail.com>
  • Loading branch information
2 people authored and rochaporto committed Jun 22, 2020
1 parent 13789ea commit a9cd3ff
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/sops/main.go
Expand Up @@ -474,9 +474,15 @@ func main() {
},
}, keyserviceFlags...),
Action: func(c *cli.Context) error {
configPath, err := config.FindConfigFile(".")
if err != nil {
return common.NewExitError(err, codes.ErrorGeneric)
var err error
var configPath string
if c.GlobalString("config") != "" {
configPath = c.GlobalString("config")
} else {
configPath, err = config.FindConfigFile(".")
if err != nil {
return common.NewExitError(err, codes.ErrorGeneric)
}
}
if c.NArg() < 1 {
return common.NewExitError("Error: no file specified", codes.NoFileSpecified)
Expand Down

0 comments on commit a9cd3ff

Please sign in to comment.