Skip to content

Commit

Permalink
chore: check TLSVerify only if there is a host
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Nov 5, 2021
1 parent da9ffc7 commit 59a295c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,15 @@ func NewDockerProvider() (*DockerProvider, error) {
opts := []client.Opt{client.FromEnv}
if host != "" {
opts = append(opts, client.WithHost(host))
}

// for further informacion, read https://docs.docker.com/engine/security/protect-access/
if tcConfig.TLSVerify == 1 {
cacertPath := path.Join(tcConfig.CertPath, "ca.pem")
certPath := path.Join(tcConfig.CertPath, "cert.pem")
keyPath := path.Join(tcConfig.CertPath, "key.pem")
// for further informacion, read https://docs.docker.com/engine/security/protect-access/
if tcConfig.TLSVerify == 1 {
cacertPath := path.Join(tcConfig.CertPath, "ca.pem")
certPath := path.Join(tcConfig.CertPath, "cert.pem")
keyPath := path.Join(tcConfig.CertPath, "key.pem")

opts = append(opts, client.WithTLSClientConfig(cacertPath, certPath, keyPath))
opts = append(opts, client.WithTLSClientConfig(cacertPath, certPath, keyPath))
}
}

c, err := client.NewClientWithOpts(opts...)
Expand Down

0 comments on commit 59a295c

Please sign in to comment.