From 6dab1ffda37189e8573c2ddabc6c8efcb740bf02 Mon Sep 17 00:00:00 2001 From: icechen Date: Tue, 11 Jan 2022 17:10:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=94=B9etcd=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/zeus/service/lark/model/init.go | 6 ++---- pkg/etcd/etcd.go | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/zeus/service/lark/model/init.go b/app/zeus/service/lark/model/init.go index 6cd7452..1b40bdd 100644 --- a/app/zeus/service/lark/model/init.go +++ b/app/zeus/service/lark/model/init.go @@ -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) } diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index ce8d8a5..305c3c2 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -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 {