1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-26 09:09:36 -05:00

conf support mysql port

This commit is contained in:
FuXiaoHei 2014-03-29 13:40:22 +08:00
parent 6e376bb85c
commit d01820c125
2 changed files with 2 additions and 2 deletions

View file

@ -20,7 +20,7 @@ HTTP_PORT = 3000
[database] [database]
; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice ; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice
DB_TYPE = mysql DB_TYPE = mysql
HOST = HOST = 127.0.0.1:3306
NAME = gogs NAME = gogs
USER = root USER = root
PASSWD = PASSWD =

View file

@ -38,7 +38,7 @@ func SetEngine() {
var err error var err error
switch DbCfg.Type { switch DbCfg.Type {
case "mysql": case "mysql":
orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@%s/%s?charset=utf8", orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name)) DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
case "postgres": case "postgres":
orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s", orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",