Skip to content

Commit

Permalink
Improve error message when default signing key is not set (#432)
Browse files Browse the repository at this point in the history
Signed-off-by: Pritesh Bandi <[email protected]>
  • Loading branch information
priteshbandi authored Nov 7, 2022
1 parent ed5beb8 commit 40973f9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/configutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ func ResolveKey(name string) (config.KeySuite, error) {
if err != nil {
return config.KeySuite{}, err
}

// if name is empty, look for default signing key
if name == "" {
name = signingKeys.Default

// if name is still empty, return error
if name == "" {
return config.KeySuite{}, errors.New("default signing key not set." +
" Please set default singing key or specify a key name")
}
}

idx := slices.Index(signingKeys.Keys, name)
if idx < 0 {
return config.KeySuite{}, ErrKeyNotFound
Expand Down

0 comments on commit 40973f9

Please sign in to comment.