1234567891011121314151617181920212223242526272829303132 |
- package main
- import (
- "github.com/astaxie/beego"
- "github.com/astaxie/beego/logs"
- "github.com/astaxie/beego/plugins/cors"
- "github.com/beego/i18n"
- _ "server_fhl/routers"
- _ "server_fhl/util"
- )
- func main(){
- log := logs.NewLogger()
- log.SetLogger(logs.AdapterConsole,`{"level":1,"color":false}`)
- logs.SetLogger(logs.AdapterFile, `{"filename":"listener.log","maxsize":512000,"maxlines":10000,"daily":true}`)
- logs.EnableFuncCallDepth(true)
- logs.SetLogFuncCallDepth(3)
- logs.Async()
- logs.Async(1e3)
- beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
- AllowAllOrigins: true,
- AllowMethods: []string{"*"},
- AllowHeaders: []string{"*"},
- ExposeHeaders: []string{"*"},
- AllowCredentials: true,
- AllowOrigins: []string{"http://172.*.*.*:*","http://localhost:*","http://127.0.0.1:*"},
- }))
- i18n.SetMessage("zh-CN", "conf/locale_zh-CN.ini")
- i18n.SetMessage("en-US", "conf/locale_en-US.ini")
- beego.BConfig.RecoverPanic = true
- beego.Run()
- }
|