Add force-non-ssl to registry operations (#102)

This commit is contained in:
Julien 2018-11-14 16:02:41 +01:00 committed by Jess Frazelle
parent 83c621c4a7
commit 383e4f7d48
2 changed files with 7 additions and 1 deletions

View file

@ -115,6 +115,7 @@ func createRegistryClient(domain string) (*registry.Registry, error) {
Insecure: insecure,
Debug: debug,
SkipPing: skipPing,
NonSSL: forceNonSSL,
Timeout: timeout,
})
}

View file

@ -44,6 +44,7 @@ type Opt struct {
Insecure bool
Debug bool
SkipPing bool
NonSSL bool
Timeout time.Duration
Headers map[string]string
}
@ -67,7 +68,11 @@ func newFromTransport(auth types.AuthConfig, transport http.RoundTripper, opt Op
url := strings.TrimSuffix(auth.ServerAddress, "/")
if !reProtocol.MatchString(url) {
url = "https://" + url
if !opt.NonSSL {
url = "https://" + url
} else {
url = "http://" + url
}
}
tokenTransport := &TokenTransport{