|
@@ -32,47 +32,60 @@ func init() {
|
|
report_db, _ := orm.GetDB("rddp")
|
|
report_db, _ := orm.GetDB("rddp")
|
|
report_db.SetConnMaxLifetime(10 * time.Minute)
|
|
report_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
|
|
- _ = orm.RegisterDataBase("edb", "mysql", utils.MYSQL_URL_EDB)
|
|
|
|
- orm.SetMaxIdleConns("edb", 50)
|
|
|
|
- orm.SetMaxOpenConns("edb", 100)
|
|
|
|
-
|
|
|
|
- edb_db, _ := orm.GetDB("edb")
|
|
|
|
- edb_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
-
|
|
|
|
- _ = orm.RegisterDataBase("data", "mysql", utils.MYSQL_URL_DATA)
|
|
|
|
- orm.SetMaxIdleConns("data", 50)
|
|
|
|
- orm.SetMaxOpenConns("data", 100)
|
|
|
|
-
|
|
|
|
- data_db, _ := orm.GetDB("data")
|
|
|
|
- data_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
-
|
|
|
|
- _ = orm.RegisterDataBase("gl", "mysql", utils.MYSQL_URL_GL)
|
|
|
|
- orm.SetMaxIdleConns("gl", 50)
|
|
|
|
- orm.SetMaxOpenConns("gl", 100)
|
|
|
|
-
|
|
|
|
- gl, _ := orm.GetDB("gl")
|
|
|
|
- gl.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
-
|
|
|
|
- _ = orm.RegisterDataBase("weekly_trial", "mysql", utils.MYSQL_URL_WEEKLY_TRIAL)
|
|
|
|
- orm.SetMaxIdleConns("weekly_trial", 50)
|
|
|
|
- orm.SetMaxOpenConns("weekly_trial", 100)
|
|
|
|
-
|
|
|
|
- trial_datadb, _ := orm.GetDB("weekly_trial")
|
|
|
|
- trial_datadb.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
-
|
|
|
|
- _ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA)
|
|
|
|
- orm.SetMaxIdleConns("eta", 50)
|
|
|
|
- orm.SetMaxOpenConns("eta", 100)
|
|
|
|
-
|
|
|
|
- etaDb, _ := orm.GetDB("eta")
|
|
|
|
- etaDb.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
-
|
|
|
|
- _ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX)
|
|
|
|
- orm.SetMaxIdleConns("hz_cygx", 50)
|
|
|
|
- orm.SetMaxOpenConns("hz_cygx", 100)
|
|
|
|
-
|
|
|
|
- cygx_db, _ := orm.GetDB("hz_cygx")
|
|
|
|
- cygx_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
|
|
+ if utils.MYSQL_URL_EDB != "" {
|
|
|
|
+ _ = orm.RegisterDataBase("edb", "mysql", utils.MYSQL_URL_EDB)
|
|
|
|
+ orm.SetMaxIdleConns("edb", 50)
|
|
|
|
+ orm.SetMaxOpenConns("edb", 100)
|
|
|
|
+
|
|
|
|
+ edb_db, _ := orm.GetDB("edb")
|
|
|
|
+ edb_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if utils.MYSQL_URL_DATA != "" {
|
|
|
|
+ _ = orm.RegisterDataBase("data", "mysql", utils.MYSQL_URL_DATA)
|
|
|
|
+ orm.SetMaxIdleConns("data", 50)
|
|
|
|
+ orm.SetMaxOpenConns("data", 100)
|
|
|
|
+
|
|
|
|
+ data_db, _ := orm.GetDB("data")
|
|
|
|
+ data_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if utils.MYSQL_URL_GL != "" {
|
|
|
|
+ _ = orm.RegisterDataBase("gl", "mysql", utils.MYSQL_URL_GL)
|
|
|
|
+ orm.SetMaxIdleConns("gl", 50)
|
|
|
|
+ orm.SetMaxOpenConns("gl", 100)
|
|
|
|
+
|
|
|
|
+ gl, _ := orm.GetDB("gl")
|
|
|
|
+ gl.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if utils.MYSQL_URL_WEEKLY_TRIAL != "" {
|
|
|
|
+ _ = orm.RegisterDataBase("weekly_trial", "mysql", utils.MYSQL_URL_WEEKLY_TRIAL)
|
|
|
|
+ orm.SetMaxIdleConns("weekly_trial", 50)
|
|
|
|
+ orm.SetMaxOpenConns("weekly_trial", 100)
|
|
|
|
+
|
|
|
|
+ trial_datadb, _ := orm.GetDB("weekly_trial")
|
|
|
|
+ trial_datadb.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if utils.MYSQL_URL_ETA != "" {
|
|
|
|
+ _ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA)
|
|
|
|
+ orm.SetMaxIdleConns("eta", 50)
|
|
|
|
+ orm.SetMaxOpenConns("eta", 100)
|
|
|
|
+
|
|
|
|
+ etaDb, _ := orm.GetDB("eta")
|
|
|
|
+ etaDb.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if utils.MYSQL_URL_CYGX != "" {
|
|
|
|
+ _ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX)
|
|
|
|
+ orm.SetMaxIdleConns("hz_cygx", 50)
|
|
|
|
+ orm.SetMaxOpenConns("hz_cygx", 100)
|
|
|
|
+
|
|
|
|
+ cygx_db, _ := orm.GetDB("hz_cygx")
|
|
|
|
+ cygx_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
+ }
|
|
|
|
|
|
orm.Debug = true
|
|
orm.Debug = true
|
|
orm.DebugLog = orm.NewLog(utils.Binlog)
|
|
orm.DebugLog = orm.NewLog(utils.Binlog)
|