Files
data-engine/main.go
2026-06-11 13:06:54 +08:00

54 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"dataengine/controller/debug"
"dataengine/controller/dict"
"dataengine/controller/public"
reportCtrl "dataengine/controller/report"
syncCtrl "dataengine/controller/sync"
syncSvc "dataengine/service/sync"
"os"
"os/signal"
"syscall"
"gitea.redpowerfuture.com/red-future/common/http"
"gitea.redpowerfuture.com/red-future/common/jaeger"
_ "gitea.redpowerfuture.com/red-future/common/k3sconfig"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/sirupsen/logrus"
)
func main() {
ctx := gctx.New()
defer jaeger.ShutDown(ctx)
// 启动自动同步(后台循环执行,首次全量后续增量)
syncSvc.InitAndStartAutoSync(ctx)
http.RouteRegister([]interface{}{
// 接口管理
dict.ApiInterface,
dict.DatasourcePlatform,
// 平台同步引擎
syncCtrl.PlatformSyncController,
// 公共查询接口
public.PublicQuery,
// 报表引擎 CRUD API
reportCtrl.ReportController,
})
// 管理后台页面
g.Server().BindHandler("/admin", debug.DebugController.DebugPage)
// 报表引擎管理页面
g.Server().BindHandler("/admin/report", reportCtrl.ReportAdminPage)
// 捕获退出信号,实现优雅关闭
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
sig := <-quit
logrus.Infof("收到信号 %v正在退出...", sig)
}