Browse code

Check if CertsDir is not empty

Signed-off-by: Michal Gebauer <mishak@mishak.net>

Michal Gebauer authored on 2015/11/20 07:30:29
Showing 2 changed files
... ...
@@ -8,7 +8,9 @@ const (
8 8
 
9 9
 	// DefaultV2Registry is the URI of the default v2 registry
10 10
 	DefaultV2Registry = "https://registry-1.docker.io"
11
+)
11 12
 
13
+var (
12 14
 	// CertsDir is the directory where certificates are stored
13 15
 	CertsDir = "/etc/docker/certs.d"
14 16
 )
... ...
@@ -62,7 +62,7 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
62 62
 
63 63
 	tlsConfig.InsecureSkipVerify = !isSecure
64 64
 
65
-	if isSecure {
65
+	if isSecure && CertsDir != "" {
66 66
 		hostDir := filepath.Join(CertsDir, cleanPath(hostname))
67 67
 		logrus.Debugf("hostDir: %s", hostDir)
68 68
 		if err := ReadCertsDirectory(&tlsConfig, hostDir); err != nil {