From 73a209107e3e17f5700b8fa494243027d683745a Mon Sep 17 00:00:00 2001 From: Michal Gebauer Date: Thu, 19 Nov 2015 23:30:29 +0100 Subject: [PATCH] Check if CertsDir is not empty Signed-off-by: Michal Gebauer --- docs/config_unix.go | 2 ++ docs/registry.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/config_unix.go b/docs/config_unix.go index 32f167d0..df970181 100644 --- a/docs/config_unix.go +++ b/docs/config_unix.go @@ -8,7 +8,9 @@ const ( // DefaultV2Registry is the URI of the default v2 registry DefaultV2Registry = "https://registry-1.docker.io" +) +var ( // CertsDir is the directory where certificates are stored CertsDir = "/etc/docker/certs.d" ) diff --git a/docs/registry.go b/docs/registry.go index 9c8666ea..6a0587a2 100644 --- a/docs/registry.go +++ b/docs/registry.go @@ -62,7 +62,7 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) { tlsConfig.InsecureSkipVerify = !isSecure - if isSecure { + if isSecure && CertsDir != "" { hostDir := filepath.Join(CertsDir, cleanPath(hostname)) logrus.Debugf("hostDir: %s", hostDir) if err := ReadCertsDirectory(&tlsConfig, hostDir); err != nil {