12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package init
- import (
- "app.yhyue.com/moapp/jypkg/compatible"
- "app.yhyue.com/moapp/jypkg/middleground"
- "flag"
- _ "github.com/go-sql-driver/mysql"
- "github.com/zeromicro/go-zero/core/conf"
- "jyBXBase/rpc/internal/config"
- )
- var configFile = flag.String("cf", "etc/bxbase.yaml", "the config file")
- var C config.Config
- var err error
- var dbFile = flag.String("df", "etc/db.yaml", "the db file")
- var DB config.Db
- var logFile = flag.String("lf", "etc/logs.yaml", "the logs file")
- var Middleground *middleground.Middleground
- var Compatible *compatible.Compatible
- func init() {
- //基本配置
- conf.MustLoad(*configFile, &C)
- //数据库配置
- conf.MustLoad(*dbFile, &DB)
- //初始mongodb
- MongoDBInit(&DB.Mongo)
- //初始化msyql
- MysqlInit(&DB.Mysql)
- //初始redis
- RedisInit(&DB.Redis)
- //初始es
- EsInit(&DB.Es)
- Middleground = middleground.NewMiddleground(C.Etcd.Hosts).
- //Middleground = middleground.NewMiddleground([]string{"192.168.3.149:2379"}).
- RegUserCenter(C.UserCenterKey).
- RegPowerCheckCenter(C.PowerCheckCenterKey).
- RegEntManageApplication(C.EntManageApplication)
- Compatible = compatible.NewCompatible(&Mgo, BaseServiceMysql, MainMysql, Middleground)
- }
|