feat : 取消旧连接
continuous-integration/drone/push Build is failing Details

master
liuhaotian 2022-01-14 20:20:22 +08:00
parent e24e71cf02
commit 4499fd93e3
1 changed files with 0 additions and 17 deletions

View File

@ -8,7 +8,6 @@ import (
clientV3 "go.etcd.io/etcd/client/v3" clientV3 "go.etcd.io/etcd/client/v3"
"go.uber.org/zap" "go.uber.org/zap"
"os" "os"
"strings"
"time" "time"
) )
@ -76,22 +75,6 @@ func GetConfigKey(key string) string {
return "" return ""
} }
} }
func init() {
connect()
}
func connect() {
envDefault := GetEnvDefault(EtcdEnd, EtcdEndDefault)
ends := strings.Split(envDefault, ",")
config = clientV3.Config{
Endpoints: ends,
DialTimeout: 5 * time.Second,
}
if client, err = clientV3.New(config); err != nil {
ctxLogger.FError(nil, error_process.EtcConnError, zap.String("", err.Error()))
os.Exit(-1)
}
}
func GetEnvDefault(key, defVal string) string { func GetEnvDefault(key, defVal string) string {
val, ex := os.LookupEnv(key) val, ex := os.LookupEnv(key)