Skip to content

Commit

Permalink
close tikv#4490: add teset
Browse files Browse the repository at this point in the history
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
  • Loading branch information
CabinfeverB committed Dec 22, 2021
1 parent baa5163 commit 03d8030
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/pd-ctl/pdctl/command/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/pingcap/errors"
"github.com/spf13/cobra"
"github.com/tikv/pd/pkg/apiutil"
"go.etcd.io/etcd/pkg/transport"
)

var (
Expand All @@ -35,11 +36,21 @@ var (

// InitHTTPSClient creates https client with ca file
func InitHTTPSClient(caPath, certPath, keyPath string) error {
tlsInfo := transport.TLSInfo{
CertFile: certPath,
KeyFile: keyPath,
TrustedCAFile: caPath,
}
tlsConfig, err := tlsInfo.ClientConfig()
if err != nil {
return errors.WithStack(err)
}

dialClient = &http.Client{
Transport: &apiutil.UserSignatureRoundTripper{
Component: "pdctl",
Proxied: http.DefaultTransport,
Proxied: &http.Transport{
TLSClientConfig: tlsConfig},
},
}

Expand Down

0 comments on commit 03d8030

Please sign in to comment.