(checkCredStore bool, serverAddress string, isDefaultRegistry bool)
| 121 | } |
| 122 | |
| 123 | func getDefaultAuthConfig(checkCredStore bool, serverAddress string, isDefaultRegistry bool) (*dockerregistry.AuthConfig, error) { |
| 124 | var authconfig dockerregistry.AuthConfig |
| 125 | var err error |
| 126 | |
| 127 | if !isDefaultRegistry { |
| 128 | serverAddress = registry.ConvertToHostname(serverAddress) |
| 129 | } |
| 130 | |
| 131 | if checkCredStore { |
| 132 | configfile, err := LoadDockerConfig() |
| 133 | if configfile != nil && err == nil { |
| 134 | authconfigOrig, err := configfile.GetAuthConfig(serverAddress) |
| 135 | if err != nil { |
| 136 | authconfig.ServerAddress = serverAddress |
| 137 | return &authconfig, err |
| 138 | } |
| 139 | |
| 140 | // convert |
| 141 | err = util.Convert(authconfigOrig, &authconfig) |
| 142 | if err != nil { |
| 143 | authconfig.ServerAddress = serverAddress |
| 144 | return &authconfig, err |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | authconfig.ServerAddress = serverAddress |
| 150 | return &authconfig, err |
| 151 | } |
no test coverage detected