generated from pkg/go-template
feat: 更改etcd默认地址
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d47feba0ba
commit
6dab1ffda3
|
@ -1,13 +1,11 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"git.icechen.cn/monorepo/backend/pkg/orm"
|
||||
)
|
||||
|
||||
var db *gorm.DB
|
||||
|
||||
func init() {
|
||||
err := db.AutoMigrate(&UserInfo{})
|
||||
err := orm.DB.AutoMigrate(&UserInfo{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
var (
|
||||
EndPoints = "ENDPOINTS"
|
||||
EndAddress = "etcd:2379"
|
||||
EndAddress = "etcd." + env.Namespace + ":2379"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -40,7 +40,7 @@ func GetValue(key string) (string, error) {
|
|||
}
|
||||
kv := clientV3.NewKV(client)
|
||||
defer client.Close()
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), time.Minute*3)
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), time.Second*3)
|
||||
defer cancel()
|
||||
if getResp, err := kv.Get(ctx, key, clientV3.WithPrefix()); err == nil {
|
||||
if len(getResp.Kvs) > 0 {
|
||||
|
|
Loading…
Reference in New Issue