From 37e6e9171dcba72c3df3f99e399af37493935d8c Mon Sep 17 00:00:00 2001 From: Tuhin Date: Thu, 7 May 2020 21:48:41 +0700 Subject: [PATCH 1/5] update 'updatekeys' subcommand to use config (if exists) from commandline --- cmd/sops/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 0b5e4ce11..1c7966077 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -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.String("config") != "" { + configPath = c.String("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) From 2d10032d8738d6c1b2ebb00f8a3470bc89d3cb0c Mon Sep 17 00:00:00 2001 From: Tuhin Date: Thu, 7 May 2020 22:09:28 +0700 Subject: [PATCH 2/5] Fix #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. --- cmd/sops/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 1c7966077..a7134407f 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -476,6 +476,7 @@ func main() { Action: func(c *cli.Context) error { var err error var configPath string + // Check if config is provided though the command line if c.String("config") != "" { configPath = c.String("config") } else { From 3920d7536c39ca325f3b2ec7b0dee3f12474e038 Mon Sep 17 00:00:00 2001 From: Tuhin Date: Fri, 8 May 2020 00:06:43 +0700 Subject: [PATCH 3/5] Fix #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. --- - | 0 cmd/sops/main.go | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 - diff --git a/- b/- new file mode 100644 index 000000000..e69de29bb diff --git a/cmd/sops/main.go b/cmd/sops/main.go index a7134407f..9656baa0b 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -477,8 +477,8 @@ func main() { var err error var configPath string // Check if config is provided though the command line - if c.String("config") != "" { - configPath = c.String("config") + if c.GlobalString("config") != "" { + configPath = c.GlobalString("config") } else { configPath, err = config.FindConfigFile(".") if err != nil { From c18582e3fe0b2210b8e85cd263a81d4181976f34 Mon Sep 17 00:00:00 2001 From: Tuhin Date: Fri, 8 May 2020 13:43:04 +0700 Subject: [PATCH 4/5] Fix #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 --- - | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 - diff --git a/- b/- deleted file mode 100644 index e69de29bb..000000000 From 87656bdbbf865054cb791e84c12beb431b6f826f Mon Sep 17 00:00:00 2001 From: Adrian Utrilla Date: Fri, 8 May 2020 17:32:15 +0200 Subject: [PATCH 5/5] Update cmd/sops/main.go --- cmd/sops/main.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 9656baa0b..ee03072c3 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -476,7 +476,6 @@ func main() { Action: func(c *cli.Context) error { var err error var configPath string - // Check if config is provided though the command line if c.GlobalString("config") != "" { configPath = c.GlobalString("config") } else {