Skip to content

Commit de24a3b

Browse files
committed
validated fix
1 parent f6f71c4 commit de24a3b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

dockerutil/client.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,24 @@ func parseConfig(cfg dockercfg.Config, reg string) (AuthConfig, error) {
8585
return toAuthConfig(username, secret), nil
8686
}
8787

88-
// // This to preserve backwards compatibility with older variants of envbox
89-
// // that didn't mandate a hostname key in the config file. We just take the
90-
// // first valid auth config we find and use that.
91-
// for _, auth := range cfg.AuthConfigs {
92-
// if auth.IdentityToken != "" {
93-
// return toAuthConfig("", auth.IdentityToken), nil
94-
// }
95-
96-
// if auth.Username != "" && auth.Password != "" {
97-
// return toAuthConfig(auth.Username, auth.Password), nil
98-
// }
99-
100-
// username, secret, err = dockercfg.DecodeBase64Auth(auth)
101-
// if err == nil && secret != "" {
102-
// return toAuthConfig(username, secret), nil
103-
// }
104-
// // Invalid auth config, skip it.
105-
// }
88+
// This to preserve backwards compatibility with older variants of envbox
89+
// that didn't mandate a hostname key in the config file. We just take the
90+
// first valid auth config we find and use that.
91+
for _, auth := range cfg.AuthConfigs {
92+
if auth.IdentityToken != "" {
93+
return toAuthConfig("", auth.IdentityToken), nil
94+
}
95+
96+
if auth.Username != "" && auth.Password != "" {
97+
return toAuthConfig(auth.Username, auth.Password), nil
98+
}
99+
100+
username, secret, err = dockercfg.DecodeBase64Auth(auth)
101+
if err == nil && secret != "" {
102+
return toAuthConfig(username, secret), nil
103+
}
104+
// Invalid auth config, skip it.
105+
}
106106

107107
return AuthConfig{}, xerrors.Errorf("no auth config found for registry %s: %w", reg, os.ErrNotExist)
108108
}

0 commit comments

Comments
 (0)