Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Apr 26, 2023
1 parent f9a7984 commit 97871d1
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions internal/credential/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@ import (
// NewStore generates a store based on the passed-in config file paths.
func NewStore(configPaths ...string) (credentials.Store, error) {
opts := credentials.StoreOptions{AllowPlaintextPut: true}
var store credentials.Store
var err error
if len(configPaths) == 0 {
// use default docker config file path
store, err = credentials.NewStoreFromDocker(opts)
} else {
var stores []credentials.Store
for _, config := range configPaths {
store, err := credentials.NewStore(config, opts)
if err != nil {
return nil, err
}
stores = append(stores, store)
return credentials.NewStoreFromDocker(opts)
}

var stores []credentials.Store
for _, config := range configPaths {
store, err := credentials.NewStore(config, opts)
if err != nil {
return nil, err
}
store, err = credentials.NewStoreWithFallbacks(stores[0], stores[1:]...), nil
stores = append(stores, store)
}
return store, err
return credentials.NewStoreWithFallbacks(stores[0], stores[1:]...), nil
}

0 comments on commit 97871d1

Please sign in to comment.