generated from pkg/go-template
feat : 取消旧连接
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
e24e71cf02
commit
4499fd93e3
|
@ -8,7 +8,6 @@ import (
|
|||
clientV3 "go.etcd.io/etcd/client/v3"
|
||||
"go.uber.org/zap"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -76,22 +75,6 @@ func GetConfigKey(key string) string {
|
|||
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 {
|
||||
val, ex := os.LookupEnv(key)
|
||||
|
|
Loading…
Reference in New Issue