Skip to content

Commit

Permalink
try to find auth by adding https://
Browse files Browse the repository at this point in the history
fixes #32

Signed-off-by: Jess Frazelle <acidburn@google.com>
  • Loading branch information
jessfraz committed Jul 17, 2017
1 parent 78e58d7 commit 0499ee2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 c.GlobalString("registry") != "" {
// try with the user input
if creds, ok := dcfg.AuthConfigs[c.GlobalString("registry")]; ok {
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"))
}

Expand Down

0 comments on commit 0499ee2

Please sign in to comment.