Fix dataSourceName config to use correct DB host in Docker.

This commit is contained in:
Gucheng Wang
2021-12-12 23:42:40 +08:00
parent b2f2674d3e
commit 589c0404d2
5 changed files with 41 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import (
"runtime"
"github.com/astaxie/beego"
"github.com/casbin/casdoor/conf"
_ "github.com/go-sql-driver/mysql" // db = mysql
//_ "github.com/lib/pq" // db = postgres
"xorm.io/xorm"
@ -36,7 +37,7 @@ func InitConfig() {
}
func InitAdapter() {
adapter = NewAdapter(beego.AppConfig.String("driverName"), beego.AppConfig.String("dataSourceName"), beego.AppConfig.String("dbName"))
adapter = NewAdapter(beego.AppConfig.String("driverName"), conf.GetBeegoConfDataSourceName(), beego.AppConfig.String("dbName"))
adapter.createTable()
}