main.go 556 字节
package main

import (
	"oppmg/common"
	_ "oppmg/routers"

	"oppmg/common/config"
	"oppmg/common/log"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
)

func main() {
	common.ResetCommonConfig()
	log.Debug("加载配置%s", config.MConfig.ConfigName)
	orm.RegisterDataBase("default", "mysql", config.MConfig.SqlConn)
	if beego.BConfig.RunMode == "dev" {
		beego.BConfig.WebConfig.DirectoryIndex = true
		beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
	}
	log.Debug("应用启动")
	beego.Run()
}