1
0
mirror of https://github.com/beego/bee.git synced 2024-12-22 04:50:49 +00:00

Update apiapp.go

Add error handling for beego.AppConfig.String("sqlconn") in line 102
This commit is contained in:
DataSttructure 2021-08-12 17:57:59 +08:00 committed by GitHub
parent bdeabd3b70
commit e22201eae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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"