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

Method LoadFromReader

cli/config/configfile/file.go:127–144  ·  view source on GitHub ↗

LoadFromReader reads the configuration data given and sets up the auth config information with given directory and populates the receiver object

(configData io.Reader)

Source from the content-addressed store, hash-verified

125// LoadFromReader reads the configuration data given and sets up the auth config
126// information with given directory and populates the receiver object
127func (c *ConfigFile) LoadFromReader(configData io.Reader) error {
128 if err := json.NewDecoder(configData).Decode(c); err != nil && !errors.Is(err, io.EOF) {
129 return err
130 }
131 var err error
132 for addr, ac := range c.AuthConfigs {
133 if ac.Auth != "" {
134 ac.Username, ac.Password, err = decodeAuth(ac.Auth)
135 if err != nil {
136 return err
137 }
138 }
139 ac.Auth = ""
140 ac.ServerAddress = addr
141 c.AuthConfigs[addr] = ac
142 }
143 return nil
144}
145
146// ContainsAuth returns whether there is authentication configured
147// in this file or not.

Callers 6

readCredentialsFunction · 0.95
LoadFromReaderFunction · 0.95
loadFunction · 0.80
TestPluginConfigFunction · 0.80

Calls 1

decodeAuthFunction · 0.85

Tested by 3

TestPluginConfigFunction · 0.64