Browse Source
Merge pull request #29 from haimait/haima_edit_admin_config
mysql 加打开日志打印模式 已采纳
main
蒋吉兆
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
16 additions and
9 deletions
-
QMPlusServer/config/config.go
-
QMPlusServer/init/qmsql/initMysql.go
-
QMPlusServer/static/config/config.json
|
|
@ -31,11 +31,14 @@ type CasbinConfig struct { //casbin配置 |
|
|
|
} |
|
|
|
|
|
|
|
type MysqlAdmin struct { // mysql admin 数据库配置
|
|
|
|
Username string `json:"username"` |
|
|
|
Password string `json:"password"` |
|
|
|
Path string `json:"path"` |
|
|
|
Dbname string `json:"dbname"` |
|
|
|
Config string `json:"config"` |
|
|
|
Username string `json:"username"` |
|
|
|
Password string `json:"password"` |
|
|
|
Path string `json:"path"` |
|
|
|
Dbname string `json:"dbname"` |
|
|
|
Config string `json:"config"` |
|
|
|
MaxIdleConns int `json:"maxIdleConns"` |
|
|
|
MaxOpenConns int `json:"maxOpenConns"` |
|
|
|
LogMode bool `json:"maxOpenConns"` |
|
|
|
} |
|
|
|
|
|
|
|
type RedisAdmin struct { // Redis admin 数据库配置
|
|
|
|
|
|
@ -18,8 +18,9 @@ func InitMysql(admin config.MysqlAdmin) *gorm.DB { |
|
|
|
log.Fatalf("DEFAULTDB数据库启动异常: %s", err) |
|
|
|
} else { |
|
|
|
DEFAULTDB = db |
|
|
|
DEFAULTDB.DB().SetMaxIdleConns(10) |
|
|
|
DEFAULTDB.DB().SetMaxOpenConns(100) |
|
|
|
DEFAULTDB.DB().SetMaxIdleConns(admin.MaxIdleConns) |
|
|
|
DEFAULTDB.DB().SetMaxOpenConns(admin.MaxOpenConns) |
|
|
|
DEFAULTDB.LogMode(admin.LogMode) |
|
|
|
} |
|
|
|
return DEFAULTDB |
|
|
|
} |
|
|
@ -7,10 +7,13 @@ |
|
|
|
}, |
|
|
|
"mysqladmin": { |
|
|
|
"username": "root", |
|
|
|
"password": "Aa@6447985", |
|
|
|
"password": "123456", |
|
|
|
"path": "127.0.0.1:3306", |
|
|
|
"dbname": "qmPlus", |
|
|
|
"config": "charset=utf8\u0026parseTime=True\u0026loc=Local" |
|
|
|
"config": "charset=utf8\u0026parseTime=True\u0026loc=Local", |
|
|
|
"maxIdleConns": 10, |
|
|
|
"maxOpenConns": 100, |
|
|
|
"logMode": true |
|
|
|
}, |
|
|
|
"qiniu": { |
|
|
|
"accessKey": "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ", |
|
|
|