Add custom mysql database port. (#289)
This commit is contained in:
parent
816b537787
commit
554493dea4
2 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue