MCPcopy Create free account
hub / github.com/docker/cli / GetAll

Method GetAll

cli/config/credentials/native_store.go:60–87  ·  view source on GitHub ↗

GetAll retrieves all the credentials from the native store.

()

Source from the content-addressed store, hash-verified

58
59// GetAll retrieves all the credentials from the native store.
60func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) {
61 auths, err := c.listCredentialsInStore()
62 if err != nil {
63 return nil, err
64 }
65
66 // Emails are only stored in the file store.
67 // This call can be safely eliminated when emails are removed.
68 fileConfigs, _ := c.fileStore.GetAll()
69
70 authConfigs := make(map[string]types.AuthConfig)
71 for registry := range auths {
72 creds, err := c.getCredentialsFromStore(registry)
73 if err != nil {
74 return nil, err
75 }
76 ac := fileConfigs[registry] // might contain Email
77 ac.Username = creds.Username
78 ac.Password = creds.Password
79 ac.IdentityToken = creds.IdentityToken
80 if ac.ServerAddress == "" {
81 ac.ServerAddress = creds.ServerAddress
82 }
83 authConfigs[registry] = ac
84 }
85
86 return authConfigs, nil
87}
88
89// Store saves the given credentials in the file store.
90func (c *nativeStore) Store(authConfig types.AuthConfig) error {

Callers 1

TestNativeStoreGetAllFunction · 0.95

Calls 3

GetAllMethod · 0.65

Tested by 1

TestNativeStoreGetAllFunction · 0.76