update main to import gateway module

This commit is contained in:
medcl 2022-01-23 19:27:54 +08:00
parent 88d15e3c3e
commit 9d4a83a792
1 changed files with 17 additions and 11 deletions

28
main.go
View File

@ -19,7 +19,7 @@ import (
"infini.sh/framework/modules/task" "infini.sh/framework/modules/task"
"infini.sh/framework/modules/ui" "infini.sh/framework/modules/ui"
"infini.sh/framework/plugins/elastic/json_indexing" "infini.sh/framework/plugins/elastic/json_indexing"
"infini.sh/gateway/proxy" api2 "infini.sh/gateway/api"
"infini.sh/search-center/config" "infini.sh/search-center/config"
"infini.sh/search-center/model" "infini.sh/search-center/model"
"infini.sh/search-center/model/alerting" "infini.sh/search-center/model/alerting"
@ -36,15 +36,16 @@ func main() {
terminalHeader += ("/ /__| (_) | | | \\__ \\ (_) | | __/\n") terminalHeader += ("/ /__| (_) | | | \\__ \\ (_) | | __/\n")
terminalHeader += ("\\____/\\___/|_| |_|___/\\___/|_|\\___|\n\n") terminalHeader += ("\\____/\\___/|_| |_|___/\\___/|_|\\___|\n\n")
terminalFooter := "" terminalFooter := ""
app := framework.NewApp("console", "the easiest way to operate your own elasticsearch platform.", app := framework.NewApp("console", "the easiest way to operate your own elasticsearch platform.",
config.Version, config.LastCommitLog, config.BuildDate,config.EOLDate, terminalHeader, terminalFooter) config.Version, config.LastCommitLog, config.BuildDate, config.EOLDate, terminalHeader, terminalFooter)
app.Init(nil) app.Init(nil)
defer app.Shutdown() defer app.Shutdown()
api := api2.GatewayAPI{}
if app.Setup(func() { if app.Setup(func() {
//load core modules first //load core modules first
@ -56,15 +57,15 @@ func main() {
module.RegisterSystemModule(&ui.UIModule{}) module.RegisterSystemModule(&ui.UIModule{})
module.RegisterSystemModule(&pipeline.PipeModule{}) module.RegisterSystemModule(&pipeline.PipeModule{})
module.RegisterSystemModule(&task.TaskModule{}) module.RegisterSystemModule(&task.TaskModule{})
module.RegisterSystemModule(&proxy.GatewayModule{})
pipe.RegisterProcessorPlugin("json_indexing", json_indexing.New) pipe.RegisterProcessorPlugin("json_indexing", json_indexing.New)
module.RegisterUserPlugin(&metrics.MetricsModule{}) module.RegisterUserPlugin(&metrics.MetricsModule{})
api.RegisterAPI("")
appConfig = &config.AppConfig{ appConfig = &config.AppConfig{
Elasticsearch: "default", Elasticsearch: "default",
UI: config.UIConfig{ UI: config.UIConfig{
LocalPath: ".public", LocalPath: ".public",
VFSEnabled: true, VFSEnabled: true,
LocalEnabled: true, LocalEnabled: true,
}, },
@ -97,21 +98,26 @@ func main() {
//} //}
//start each module, with enabled provider //start each module, with enabled provider
module.Start()
}, func() { }, func() {
module.Start()
orm.RegisterSchemaWithIndexName(model.Dict{}, "dict") orm.RegisterSchemaWithIndexName(model.Dict{}, "dict")
orm.RegisterSchemaWithIndexName(model.Reindex{}, "reindex") orm.RegisterSchemaWithIndexName(model.Reindex{}, "reindex")
orm.RegisterSchemaWithIndexName(elastic.View{}, "view") orm.RegisterSchemaWithIndexName(elastic.View{}, "view")
orm.RegisterSchemaWithIndexName(alerting.Config{}, "alerting-config") orm.RegisterSchemaWithIndexName(alerting.Config{}, "alerting-config")
orm.RegisterSchemaWithIndexName(alerting.Alert{}, "alerting-alerts") orm.RegisterSchemaWithIndexName(alerting.Alert{}, "alerting-alerts")
orm.RegisterSchemaWithIndexName(alerting.AlertingHistory{}, "alerting-alert-history") orm.RegisterSchemaWithIndexName(alerting.AlertingHistory{}, "alerting-history")
orm.RegisterSchema(elastic.CommonCommand{}) orm.RegisterSchemaWithIndexName(elastic.CommonCommand{}, "commands")
orm.RegisterSchemaWithIndexName(elastic.TraceTemplate{}, "trace-template") orm.RegisterSchemaWithIndexName(elastic.TraceTemplate{}, "trace-template")
api.RegisterSchema()
alertSrv.GetScheduler().Start() alertSrv.GetScheduler().Start()
},nil){
}, nil) {
app.Run() app.Run()
} }
} }