61 lines
1.9 KiB
Go
61 lines
1.9 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
_ "github.com/fonchain_enterprise/fonchain-main/pkg/common/filter"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/config"
|
|
pkgcron "github.com/fonchain_enterprise/fonchain-main/pkg/cron"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/e"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/es"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/mq"
|
|
pkgOaCron "github.com/fonchain_enterprise/fonchain-main/pkg/oa_cron"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/register"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/router"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/service"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/service/artistInfo/artistInfoTask"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/service/auth/sso"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/tracing"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/utils"
|
|
"github.com/robfig/cron/v3"
|
|
)
|
|
|
|
// export DUBBO_GO_CONFIG_PATH=$PATH_TO_APP/conf/dubbogo.yaml
|
|
func main() {
|
|
config.GetOptions()
|
|
if config.JaegerOpen {
|
|
tracing.InitTracing()
|
|
}
|
|
// rabbitmq 初始化
|
|
mq.NewRabbitMq()
|
|
if err := utils.InitTrans("zh"); err != nil {
|
|
panic(e.Error)
|
|
}
|
|
if config.Cron {
|
|
c := cron.New()
|
|
service.Task(c)
|
|
pkgcron.Task(c)
|
|
pkgOaCron.Task(c)
|
|
artistInfoTask.Task(c)
|
|
service.OneQueryTask(c)
|
|
c.Start()
|
|
fmt.Println("======================================= 打印定时任务 =====================================================")
|
|
for i := 0; i < len(c.Entries()); i++ {
|
|
fmt.Println("定时任务", c.Entries()[i])
|
|
}
|
|
fmt.Println("======================================= 打印定时任务 =====================================================")
|
|
}
|
|
register.Register()
|
|
//sso init
|
|
sso.LoadEnv()
|
|
if config.AppMode != "local" {
|
|
es.InitElastic()
|
|
}
|
|
r := router.NewRouter()
|
|
if config.RunHttps {
|
|
_ = r.RunTLS(config.HttpPort, config.Cert, config.Key)
|
|
} else {
|
|
_ = r.Run(config.HttpPort)
|
|
}
|
|
select {}
|
|
}
|