Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
Signed-off-by: Min Min <[email protected]>
  • Loading branch information
jamsman94 committed Apr 19, 2022
1 parent fe57489 commit 14bfe4c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package registry
import (
"context"
"crypto/tls"
"crypto/x509"
"encoding/json"
"fmt"
"net"
Expand Down Expand Up @@ -111,7 +112,6 @@ type authClient struct {
}

func (s *v2RegistryService) createClient(ep Endpoint, logger *zap.SugaredLogger) (cli *authClient, err error) {
fmt.Printf("creating registry client for ep: %s, cert: %s, enableTLS: %s", ep, s.CustomCert, s.EnableHTTPS)
endpointURL, err := url.Parse(ep.Addr)
if err != nil {
return
Expand All @@ -125,7 +125,11 @@ func (s *v2RegistryService) createClient(ep Endpoint, logger *zap.SugaredLogger)

tlsConfig := &tls.Config{}

if (s.EnableHTTPS && s.CustomCert != "") || !s.EnableHTTPS {
if s.EnableHTTPS && s.CustomCert != "" {
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM([]byte(s.CustomCert))
tlsConfig.RootCAs = caCertPool
} else if !s.EnableHTTPS {
tlsConfig.InsecureSkipVerify = true
}

Expand Down

0 comments on commit 14bfe4c

Please sign in to comment.