Browse Source

Merge branch 'feature/tmr-group' of baishaojie/tmrgo into develop

xuyiping 1 year ago
parent
commit
4f21babe5e
3 changed files with 14 additions and 35 deletions
  1. 5 10
      conf/app-test.ini
  2. 0 24
      conf/app.ini
  3. 9 1
      conf/setting/setting.go

+ 5 - 10
conf/app-test.ini

@@ -41,21 +41,16 @@ Description = tmrgo
 [database]
 Type = mysql
 User = root
-Password = root
-#Host = 127.0.0.1:3326
-#Password = root
-Host = 192.168.1.103:3326
-#Password = root123456
-#Host = 47.92.52.73:3306
-#Name = equipment
-#Name = eqdev
-#Name = eq0422
-Name = tmrwatch
+Password = 123456
+Host = 192.168.1.70:3306
+Name = tmrwatch2
 TablePrefix =
 
 ShowXormlog = false
 ShowGetSqllog = false
 CacheApiSql = false
+
+
 [comm]
 PortName =
 BaudRate = 9600

+ 0 - 24
conf/app.ini

@@ -45,32 +45,8 @@ GRFDURL = http://120.48.30.31:88
 [database]
 Type = mysql
 User = root
-#Password = root
-#Host = 192.168.1.93:3326
 Host = 127.0.0.1:3306
-#Name = haiyuan
-#Password = root
-#Password = root
-#Password = kptzhu@163.com
-#Host = 192.168.1.50:3326
-#Password = root123456
-#Password = keep
-
-#Password = kptzhu@163.com
 Password = 123456
-#Password = kepaiteng!QAZ
-#Host = 47.92.52.73:3306
-#Host = 127.0.0.1:3306
-#Host = 210.16.186.252:3326
-
-#Host = 210.16.186.252:3326
-#Host = 127.0.0.1:3309
-#Name = equipment
-#Name = eqdev
-#Name = eq0422
-#Name = tmrgo
-#Password = kepaiteng!QAZ
-#Host = 222.73.129.15:31306
 Name = tmrwatch2
 TablePrefix =
 

+ 9 - 1
conf/setting/setting.go

@@ -24,6 +24,7 @@ var (
 	YynserverSetting = &Yyn{}
 	cfg              *ini.File
 	CurrentPath      string
+	appEnv           string
 )
 
 type App struct {
@@ -110,7 +111,14 @@ func Setup() {
 		CurrentPath = workDir
 	}
 
-	cfg, err = ini.Load(CurrentPath + "conf/app.ini")
+	appEnv = strings.ToLower(os.Getenv("APP_ENVIRONMENT"))
+	switch appEnv {
+	case "test":
+		cfg, err = ini.Load(CurrentPath + "conf/app-test.ini")
+	default:
+		cfg, err = ini.Load(CurrentPath + "conf/app.ini")
+	}
+
 	if err != nil {
 		log.Fatalf("setting.Setup, fail to parse 'conf/app.ini': %v", err)
 	}