Add custom mysql database port. (#289)

pull/310/head
topjohncian 5 years ago committed by GitHub
parent 816b537787
commit 554493dea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,10 +32,11 @@ func Init() {
// 未指定数据库时使用SQLite
db, err = gorm.Open("sqlite3", util.RelativePath(conf.DatabaseConfig.DBFile))
} else {
db, err = gorm.Open(conf.DatabaseConfig.Type, fmt.Sprintf("%s:%s@(%s)/%s?charset=utf8&parseTime=True&loc=Local",
db, err = gorm.Open(conf.DatabaseConfig.Type, fmt.Sprintf("%s:%s@(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local",
conf.DatabaseConfig.User,
conf.DatabaseConfig.Password,
conf.DatabaseConfig.Host,
conf.DatabaseConfig.Port,
conf.DatabaseConfig.Name))
}
}

@ -15,6 +15,7 @@ type database struct {
Name string
TablePrefix string
DBFile string
Port string
}
// system 系统通用配置

Loading…
Cancel
Save