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

@ -16,6 +16,7 @@ package original
import (
"github.com/astaxie/beego"
"github.com/casbin/casdoor/conf"
"github.com/casbin/casdoor/object"
_ "github.com/go-sql-driver/mysql" // db = mysql
//_ "github.com/lib/pq" // db = postgres
@ -36,7 +37,7 @@ func InitAdapter() bool {
return false
}
adapter = object.NewAdapter(beego.AppConfig.String("driverName"), beego.AppConfig.String("dataSourceName"), dbName)
adapter = object.NewAdapter(beego.AppConfig.String("driverName"), conf.GetBeegoConfDataSourceName(), dbName)
createTable(adapter)
return true
}