// entry function package main import ( "context" "flag" "log" "modelRT/app" _ "modelRT/docs" ) var ( modelRTConfigDir = flag.String("modelRT_config_dir", "./configs", "config file dir of model runtime service") modelRTConfigName = flag.String("modelRT_config_name", "config", "config file name of model runtime service") modelRTConfigType = flag.String("modelRT_config_type", "yaml", "config file type of model runtime service") ) // @title ModelRT 实时模型服务 API 文档 // @version 1.0 // @description 实时数据计算和模型运行服务的 API 服务 // // @contact.name douxu // TODO 修改支持的文档地址 // @contact.url http://www.swagger.io/support // @contact.email douxu@clea.com.cn // // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html // // @host localhost:8080 // @BasePath /api/v1 func main() { flag.Parse() ctx := context.Background() cli := app.CLIArgs{ ConfigDir: *modelRTConfigDir, ConfigName: *modelRTConfigName, ConfigType: *modelRTConfigType, } application, cleanup, err := app.InitializeApp(ctx, cli) if err != nil { log.Fatalf("failed to initialize app: %v", err) } defer cleanup() // warm caches from postgres, then start background publishers/worker application.Warmup(ctx) application.StartBackground(ctx) // blocks until the server is shut down application.Run(ctx) }