ensure keys are not empty

This commit is contained in:
David Zhao
2021-07-06 21:43:03 -07:00
parent 3eba7fe25c
commit 76efe14c6d
+3 -3
View File
@@ -262,11 +262,11 @@ func createKeyProvider(conf *config.Config) (auth.KeyProvider, error) {
return auth.NewFileBasedKeyProviderFromReader(f) return auth.NewFileBasedKeyProviderFromReader(f)
} }
if conf.Keys != nil { if len(conf.Keys) == 0 {
return auth.NewFileBasedKeyProviderFromMap(conf.Keys), nil return nil, errors.New("one of key-file or keys must be provided in order to support a secure installation")
} }
return nil, errors.New("one of key-file or keys must be provided in order to support a secure installation") return auth.NewFileBasedKeyProviderFromMap(conf.Keys), nil
} }
func getConfigString(c *cli.Context) (string, error) { func getConfigString(c *cli.Context) (string, error) {