Skip to content

Commit

Permalink
[updatekeys] Fix input-type cli flag being ignored
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Schrader <[email protected]>
  • Loading branch information
kleinschrader committed Dec 3, 2024
1 parent bb710f3 commit 6e16eeb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/sops/subcommand/updatekeys/updatekeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/getsops/sops/v3/cmd/sops/codes"
"github.com/getsops/sops/v3/cmd/sops/common"
"github.com/getsops/sops/v3/cmd/sops/formats"
"github.com/getsops/sops/v3/config"
"github.com/getsops/sops/v3/keyservice"
)
Expand Down Expand Up @@ -45,12 +46,23 @@ func updateFile(opts Opts) error {
if err != nil {
return err
}
store := common.DefaultStoreForPath(sc, opts.InputPath)

var store common.Store

if opts.InputType == "" {
store = common.DefaultStoreForPath(sc, opts.InputPath)
} else {
format := formats.FormatFromString(opts.InputType)
store = common.StoreForFormat(format, sc)
}

log.Printf("Syncing keys for file %s", opts.InputPath)

tree, err := common.LoadEncryptedFile(store, opts.InputPath)
if err != nil {
return err
}

conf, err := config.LoadCreationRuleForFile(opts.ConfigPath, opts.InputPath, make(map[string]*string))
if err != nil {
return err
Expand Down

0 comments on commit 6e16eeb

Please sign in to comment.