config: remove unused utility (#269)

Signed-off-by: disksing <i@disksing.com>
This commit is contained in:
disksing 2021-08-16 11:55:36 +08:00 committed by GitHub
parent 288c649636
commit b7d1044eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 37 deletions

View File

@ -36,10 +36,8 @@ package config
import (
"fmt"
"net/http"
"net/url"
"strings"
"sync"
"sync/atomic"
"github.com/pingcap/errors"
@ -205,38 +203,3 @@ func ParsePath(path string) (etcdAddrs []string, disableGC bool, err error) {
etcdAddrs = strings.Split(u.Host, ",")
return
}
var (
internalClientInit sync.Once
internalHTTPClient *http.Client
internalHTTPSchema string
)
// InternalHTTPClient is used by TiDB-Server to request other components.
func InternalHTTPClient() *http.Client {
internalClientInit.Do(initInternalClient)
return internalHTTPClient
}
// InternalHTTPSchema specifies use http or https to request other components.
func InternalHTTPSchema() string {
internalClientInit.Do(initInternalClient)
return internalHTTPSchema
}
func initInternalClient() {
clusterSecurity := GetGlobalConfig().Security
tlsCfg, err := clusterSecurity.ToTLSConfig()
if err != nil {
logutil.BgLogger().Fatal("could not load cluster ssl", zap.Error(err))
}
if tlsCfg == nil {
internalHTTPSchema = "http"
internalHTTPClient = http.DefaultClient
return
}
internalHTTPSchema = "https"
internalHTTPClient = &http.Client{
Transport: &http.Transport{TLSClientConfig: tlsCfg},
}
}