main.go 852 字节
package main

import (
	"github.com/astaxie/beego"
	_ "gitlab.fjmaimaimai.com/mmm-go/ability/routers"
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/config"
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/orm"
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/redis"
	_ "github.com/go-sql-driver/mysql"
)

func init(){
	log.InitLog(config.Logger{
		Filename:"app.log",
		Level:"7",
	})
	err:= redis.InitWithDb(100,beego.AppConfig.String("redis_add_port"),beego.AppConfig.String("redis_auth"),"0")
	if err!=nil{
		log.Fatal(err)
		panic(err)
	}
	orm.NewBeeormEngine(config.Mysql{
		DataSource:beego.AppConfig.String("data_source"),
		MaxIdle: 100,
		MaxOpen:100,
	})
}

func main() {
	defer func(){
		log.Info("app on stop!")
	}()
	log.Info("app on start!")
	log.Info("Beego Run Mode:",beego.BConfig.RunMode)
	beego.Run()
}