Skip to content

Commit

Permalink
Use same tls in binlogctl
Browse files Browse the repository at this point in the history
  • Loading branch information
july2993 committed Feb 21, 2020
1 parent be2c0c8 commit 0ab7edb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 53 deletions.
44 changes: 0 additions & 44 deletions binlogctl/global.go

This file was deleted.

14 changes: 13 additions & 1 deletion binlogctl/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,23 @@ func ApplyAction(urls, kind, nodeID string, action string, tlsConfig *tls.Config
if err != nil {
return errors.Trace(err)
}
_, err = dialClient.Do(req)
_, err = getClient(tlsConfig).Do(req)
if err == nil {
log.Info("Apply action on node success", zap.String("action", action), zap.String("NodeID", n.NodeID))
return nil
}

return errors.Trace(err)
}

func getClient(tlsConfig *tls.Config) *http.Client {
if tlsConfig == nil {
return &http.Client{}
}

return &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
},
}
}
8 changes: 0 additions & 8 deletions cmd/binlogctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tidb-binlog/binlogctl"
ctl "github.com/pingcap/tidb-binlog/binlogctl"
"github.com/pingcap/tidb-binlog/pkg/node"
"go.uber.org/zap"
Expand All @@ -42,13 +41,6 @@ func main() {
os.Exit(2)
}

if cfg.SSLCA != "" {
err = binlogctl.InitHTTPSClient(cfg.SSLCA, cfg.SSLCert, cfg.SSLKey)
if err != nil {
log.Fatal("failed to init https client", zap.Error(err))
}
}

switch cfg.Command {
case ctl.GenerateMeta:
err = ctl.GenerateMetaInfo(cfg)
Expand Down

0 comments on commit 0ab7edb

Please sign in to comment.