mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
try to find auth by adding https://
fixes #32 Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
parent
78e58d7811
commit
0499ee2f51
1 changed files with 8 additions and 0 deletions
|
@ -37,9 +37,17 @@ func GetAuthConfig(c *cli.Context) (types.AuthConfig, error) {
|
||||||
|
|
||||||
// if they passed a specific registry, return those creds _if_ they exist
|
// if they passed a specific registry, return those creds _if_ they exist
|
||||||
if c.GlobalString("registry") != "" {
|
if c.GlobalString("registry") != "" {
|
||||||
|
// try with the user input
|
||||||
if creds, ok := dcfg.AuthConfigs[c.GlobalString("registry")]; ok {
|
if creds, ok := dcfg.AuthConfigs[c.GlobalString("registry")]; ok {
|
||||||
return creds, nil
|
return creds, nil
|
||||||
}
|
}
|
||||||
|
// add https:// to user input and try again
|
||||||
|
// see https://github.com/jessfraz/reg/issues/32
|
||||||
|
if !strings.HasPrefix(c.GlobalString("registry"), "https://") && !strings.HasPrefix(c.GlobalString("registry"), "http://") {
|
||||||
|
if creds, ok := dcfg.AuthConfigs["https://"+c.GlobalString("registry")]; ok {
|
||||||
|
return creds, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
return types.AuthConfig{}, fmt.Errorf("No authentication credentials exist for %s", c.GlobalString("registry"))
|
return types.AuthConfig{}, fmt.Errorf("No authentication credentials exist for %s", c.GlobalString("registry"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue