| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package main
- import (
- "github.com/astaxie/beego"
- "lc/cloud/websvr/controllers"
- _ "lc/cloud/websvr/routers"
- "lc/common/models"
- "lc/common/util"
- )
- var redisConf util.RedisConfig
- var mysqlConf util.MySQLConfig
- func main() {
- redisConf.Redis_Address = beego.AppConfig.String("redis.addr")
- redisConf.Redis_Password = beego.AppConfig.String("redis.pass")
- controllers.InitRedis(&redisConf)
- defer controllers.UninitRedis()
- mysqlConf.Mysql_Host = beego.AppConfig.String("db.host")
- mysqlConf.Mysql_Port, _ = beego.AppConfig.Int("db.port")
- mysqlConf.Mysql_User = beego.AppConfig.String("db.user")
- mysqlConf.Mysql_Password = beego.AppConfig.String("db.password")
- mysqlConf.Mysql_Name = beego.AppConfig.String("db.name")
- mysqlConf.Mysql_Timezone = beego.AppConfig.String("db.timezone")
- models.InitDB(&mysqlConf)
- defer models.DestroyDB()
- //if beego.BConfig.RunMode == "dev" {
- // beego.BConfig.WebConfig.DirectoryIndex = true
- // beego.SetStaticPath("/swagger", "swagger")
- //}
- //beego.BeeLogger.DelLogger("console")
- beego.SetLogger("file", `{"filename":"log/websvr.log","level":7,"maxlines":0,"maxsize":0,"daily":true,"maxdays":30}`)
- beego.SetStaticPath("/file", "file")
- beego.ErrorController(&controllers.ErrorController{})
- beego.Run()
- }
|