package main

import (
	"github.com/beego/beego/v2/server/web"
	"github.com/linmadan/egglib-go/log/logrus"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/broker"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/domainService"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util/blur"

	_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego"
)

func init() {
	cache.InitRedist()
	domainService.AdvancedSettingInit()
}

func main() {
	if constant.ENABLE_KAFKA_LOG {
		w, _ := logrus.NewKafkaWriter(constant.KAFKA_HOST, constant.TOPIC_LOG_STASH, false)
		log.Logger.AddHook(w)
	}

	broker.RegisterDefaultPusherClient(constant.KAFKA_HOST, constant.TOPIC_UP_BLOCK_CHAIN)
	blur.InitDefaultConfig()
	web.Run()
}