From 8307df0d08345cd8b122c23e87a95bb10739aff2 Mon Sep 17 00:00:00 2001 From: a7458969 <290198252@qq.com> Date: Wed, 26 Feb 2020 23:10:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=87=E6=A1=A3=E6=97=B6=E5=80=99=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=88=86=E7=B1=BB=E4=B8=80=E7=9B=B4=E4=B8=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 1 + db/sqlManager.go | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 63dc0e7..299e79f 100644 --- a/config/config.go +++ b/config/config.go @@ -82,6 +82,7 @@ func Init(path string) error { log.Println(e.Error()) } gConf.init = true + log.Print(gConf) return nil } diff --git a/db/sqlManager.go b/db/sqlManager.go index d94cfac..2ab8d71 100644 --- a/db/sqlManager.go +++ b/db/sqlManager.go @@ -22,10 +22,14 @@ func Init() { mysqlconf := config.GetMysqlConfig() blogConf := config.GetMysqlBlogConfig() //InitMongoDb() - blogDb = Database{Type: string(""), DB: initMysql(blogConf)} + fmt.Print("api runmode is " + config.ApiConfig().RunMode) + if config.ApiConfig().RunMode == "debug"{ + blogDb = Database{Type: string(""), DB: initMysql(blogConf)} + }else{ + blogDb = Database{Type: string(""), DB: initMysqlTLS(blogConf)} + } if config.ApiConfig().RunMode == "debug"{ gDb = Database{Type: string(""), DB: initMysql(mysqlconf)} - }else{ gDb = Database{Type: string(""), DB: initMysqlTLS(mysqlconf)} }