Merge pull request #796 from DataSttructure/develop

fix cmd api bug
This commit is contained in:
Ming Deng 2021-08-13 23:03:21 +08:00 committed by GitHub
commit 0d739375d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -99,7 +99,11 @@ import (
)
func main() {
orm.RegisterDataBase("default", "{{.DriverName}}", beego.AppConfig.String("sqlconn"))
sqlConn,err := beego.AppConfig.String("sqlconn")
if err != nil {
beeLogger.Log.Fatal("%s", err)
}
orm.RegisterDataBase("default", "{{.DriverName}}", sqlConn)
if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"