mirror of https://github.com/docker/cli.git
Merge pull request #4823 from thaJeztah/23.0_backport_4653-fix-credential-helper
[23.0 backport] Fix setting ServerAddress property in NativeStore
This commit is contained in:
commit
4d6486dd68
|
@ -51,6 +51,7 @@ func (c *nativeStore) Get(serverAddress string) (types.AuthConfig, error) {
|
||||||
auth.Username = creds.Username
|
auth.Username = creds.Username
|
||||||
auth.IdentityToken = creds.IdentityToken
|
auth.IdentityToken = creds.IdentityToken
|
||||||
auth.Password = creds.Password
|
auth.Password = creds.Password
|
||||||
|
auth.ServerAddress = creds.ServerAddress
|
||||||
|
|
||||||
return auth, nil
|
return auth, nil
|
||||||
}
|
}
|
||||||
|
@ -76,6 +77,9 @@ func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) {
|
||||||
ac.Username = creds.Username
|
ac.Username = creds.Username
|
||||||
ac.Password = creds.Password
|
ac.Password = creds.Password
|
||||||
ac.IdentityToken = creds.IdentityToken
|
ac.IdentityToken = creds.IdentityToken
|
||||||
|
if ac.ServerAddress == "" {
|
||||||
|
ac.ServerAddress = creds.ServerAddress
|
||||||
|
}
|
||||||
authConfigs[registry] = ac
|
authConfigs[registry] = ac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,9 +145,10 @@ func TestNativeStoreGet(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
expected := types.AuthConfig{
|
expected := types.AuthConfig{
|
||||||
Username: "foo",
|
Username: "foo",
|
||||||
Password: "bar",
|
Password: "bar",
|
||||||
Email: "foo@example.com",
|
Email: "foo@example.com",
|
||||||
|
ServerAddress: validServerAddress,
|
||||||
}
|
}
|
||||||
assert.Check(t, is.DeepEqual(expected, actual))
|
assert.Check(t, is.DeepEqual(expected, actual))
|
||||||
}
|
}
|
||||||
|
@ -169,6 +170,7 @@ func TestNativeStoreGetIdentityToken(t *testing.T) {
|
||||||
expected := types.AuthConfig{
|
expected := types.AuthConfig{
|
||||||
IdentityToken: "abcd1234",
|
IdentityToken: "abcd1234",
|
||||||
Email: "foo@example2.com",
|
Email: "foo@example2.com",
|
||||||
|
ServerAddress: validServerAddress2,
|
||||||
}
|
}
|
||||||
assert.Check(t, is.DeepEqual(expected, actual))
|
assert.Check(t, is.DeepEqual(expected, actual))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue