|
|
package main
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/astaxie/beego"
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
|
...
|
...
|
@@ -10,6 +11,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/redis"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/websocket"
|
|
|
"opp/controllers"
|
|
|
"opp/internal/utils"
|
|
|
"opp/protocol"
|
|
|
_ "opp/routers"
|
|
|
"opp/services/im"
|
...
|
...
|
@@ -19,23 +21,30 @@ import ( |
|
|
func init() {
|
|
|
time.Local = time.FixedZone("CST", 3600*8)
|
|
|
log.InitLog(config.Logger{
|
|
|
Filename: "app.log",
|
|
|
Level: "7",
|
|
|
})
|
|
|
//TODO:kafka配置
|
|
|
log.InitKafkaLogger(log.KafkaConfig{
|
|
|
Topic: "ability",
|
|
|
Addrs: []string{"127.0.0.1:9092"},
|
|
|
Level: 6,
|
|
|
Filename: beego.AppConfig.String("aliyun_logs_access"),
|
|
|
Level: fmt.Sprintf("%v", utils.ResolveLogLevel(beego.AppConfig.String("log_level"))),
|
|
|
})
|
|
|
//TODO:kafka log配置
|
|
|
//log.InitKafkaLogger(log.KafkaConfig{
|
|
|
// Topic: "ability",
|
|
|
// Addrs: []string{"127.0.0.1:9092"},
|
|
|
// Level: 6,
|
|
|
//})
|
|
|
err := redis.InitWithDb(100, beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), "0")
|
|
|
if err != nil {
|
|
|
log.Fatal(err, beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"))
|
|
|
//panic(err)
|
|
|
}
|
|
|
dataSource := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?loc=Asia%%2FShanghai",
|
|
|
beego.AppConfig.String("mysql_user"),
|
|
|
beego.AppConfig.String("mysql_password"),
|
|
|
beego.AppConfig.String("mysql_host"),
|
|
|
beego.AppConfig.String("mysql_port"),
|
|
|
beego.AppConfig.String("mysql_db_name"),
|
|
|
)
|
|
|
orm.NewBeeormEngine(config.Mysql{
|
|
|
//AliasName: "default",
|
|
|
DataSource: beego.AppConfig.String("data_source"),
|
|
|
DataSource: dataSource,
|
|
|
MaxIdle: 100,
|
|
|
MaxOpen: 100,
|
|
|
})
|
...
|
...
|
|