Kaynağa Gözat

Check if CertsDir is not empty

Signed-off-by: Michal Gebauer <mishak@mishak.net>
Michal Gebauer 9 yıl önce
ebeveyn
işleme
bcd0f0cdc4
2 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 2 0
      registry/config_unix.go
  2. 1 1
      registry/registry.go

+ 2 - 0
registry/config_unix.go

@@ -8,7 +8,9 @@ const (
 
 
 	// DefaultV2Registry is the URI of the default v2 registry
 	// DefaultV2Registry is the URI of the default v2 registry
 	DefaultV2Registry = "https://registry-1.docker.io"
 	DefaultV2Registry = "https://registry-1.docker.io"
+)
 
 
+var (
 	// CertsDir is the directory where certificates are stored
 	// CertsDir is the directory where certificates are stored
 	CertsDir = "/etc/docker/certs.d"
 	CertsDir = "/etc/docker/certs.d"
 )
 )

+ 1 - 1
registry/registry.go

@@ -62,7 +62,7 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
 
 
 	tlsConfig.InsecureSkipVerify = !isSecure
 	tlsConfig.InsecureSkipVerify = !isSecure
 
 
-	if isSecure {
+	if isSecure && CertsDir != "" {
 		hostDir := filepath.Join(CertsDir, cleanPath(hostname))
 		hostDir := filepath.Join(CertsDir, cleanPath(hostname))
 		logrus.Debugf("hostDir: %s", hostDir)
 		logrus.Debugf("hostDir: %s", hostDir)
 		if err := ReadCertsDirectory(&tlsConfig, hostDir); err != nil {
 		if err := ReadCertsDirectory(&tlsConfig, hostDir); err != nil {