package init

import (
	"jyBXSubscribe/entity"
	"jyBXSubscribe/rpc/internal/config"

	"app.yhyue.com/moapp/jypkg/compatible"
	"app.yhyue.com/moapp/jypkg/middleground"
	_ "github.com/go-sql-driver/mysql"
)

var C config.Config
var err error

var DB config.Db

// var codLib
var Logc entity.Logc

func InitC() {
	//初始mongodb
	MongoDBInit(&DB.Mongo)
	//初始化msyql
	MysqlInit(&DB.Mysql)
	//初始redis
	RedisInit(&DB.Redis)
	//初始es
	EsInit(&DB.Es)
	Middleground = middleground.NewMiddleground(C.CodeServiceConf.Etcd.Hosts).
		RegUserCenter(C.UserCenterKey).
		RegPowerCheckCenter(C.PowerCheckCenterKey).
		RegEntManageApplication(C.EntManageApplication)
	Compatible = compatible.NewCompatible(&Mgo, BaseServiceMysql, MainMysql, Middleground)
}
