Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit ebd86c7

Browse files
committed
Add options for custom TLS config
Signed-off-by: Beorn Facchini <[email protected]>
1 parent 213509a commit ebd86c7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docker/client/client.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package client
22

33
import (
4+
"crypto/tls"
45
"fmt"
56
"net/http"
67
"os"
@@ -37,6 +38,7 @@ func init() {
3738
type Options struct {
3839
TLS bool
3940
TLSVerify bool
41+
TLSConfig *tls.Config
4042
TLSOptions tlsconfig.Options
4143
TrustKey string
4244
Host string
@@ -82,14 +84,17 @@ func Create(c Options) (client.APIClient, error) {
8284

8385
var httpClient *http.Client
8486
if c.TLS {
85-
config, err := tlsconfig.Client(c.TLSOptions)
86-
if err != nil {
87-
return nil, err
87+
if c.TLSConfig == nil {
88+
var err error
89+
c.TLSConfig, err = tlsconfig.Client(c.TLSOptions)
90+
if err != nil {
91+
return nil, err
92+
}
8893
}
8994

9095
httpClient = &http.Client{
9196
Transport: &http.Transport{
92-
TLSClientConfig: config,
97+
TLSClientConfig: c.TLSConfig,
9398
},
9499
}
95100
}

0 commit comments

Comments
 (0)