support embedding api to ui module
This commit is contained in:
parent
6ec84370b1
commit
a1c5394f70
21
console.yml
21
console.yml
|
@ -1,33 +1,25 @@
|
|||
#配置应用存储数据的 Elasticsearch 集群信息
|
||||
#存储极限数据平台相关数据的 Elasticsearch 集群信息,版本 v7.0+
|
||||
elasticsearch:
|
||||
- name: default
|
||||
enabled: true
|
||||
monitored: true
|
||||
endpoint: http://localhost:9200
|
||||
endpoint: http://192.168.3.188:9299
|
||||
basic_auth:
|
||||
username: elastic
|
||||
password: ZBdkVQUUdF1Sir4X4BGB
|
||||
|
||||
#前端 UI HTTP 配置
|
||||
web:
|
||||
enabled: true
|
||||
embedding_api: true
|
||||
ui:
|
||||
enabled: true
|
||||
path: .public
|
||||
vfs: true
|
||||
local: true
|
||||
#api_endpoint: 10.0.2.5:2900 #配置 api_endpoint 可覆盖默认 api 访问地址
|
||||
network:
|
||||
binding: 0.0.0.0:9000
|
||||
skip_occupied_port: true
|
||||
#API IP 地址需要在前端可连通(虚拟机环境安装,宿主机访问)
|
||||
api:
|
||||
enabled: true
|
||||
network:
|
||||
binding: 0.0.0.0:2900
|
||||
skip_occupied_port: true
|
||||
cors:
|
||||
allowed_origins:
|
||||
- "*"
|
||||
|
||||
elastic:
|
||||
elasticsearch: default
|
||||
|
@ -41,11 +33,6 @@ elastic:
|
|||
template_name: ".infini"
|
||||
index_prefix: ".infini_"
|
||||
|
||||
search-center:
|
||||
ui_path: .public
|
||||
ui_vfs: true
|
||||
ui_local: true
|
||||
|
||||
metrics:
|
||||
enabled: true
|
||||
major_ip_pattern: "192.*"
|
||||
|
|
19
main.go
19
main.go
|
@ -9,8 +9,14 @@ import (
|
|||
"infini.sh/framework/core/module"
|
||||
"infini.sh/framework/core/orm"
|
||||
pipe "infini.sh/framework/core/pipeline"
|
||||
"infini.sh/framework/modules"
|
||||
elastic2 "infini.sh/framework/modules/elastic"
|
||||
"infini.sh/framework/modules/filter"
|
||||
"infini.sh/framework/modules/metrics"
|
||||
"infini.sh/framework/modules/pipeline"
|
||||
"infini.sh/framework/modules/queue"
|
||||
"infini.sh/framework/modules/stats"
|
||||
"infini.sh/framework/modules/task"
|
||||
"infini.sh/framework/modules/ui"
|
||||
"infini.sh/framework/plugins/elastic/json_indexing"
|
||||
"infini.sh/search-center/config"
|
||||
"infini.sh/search-center/model"
|
||||
|
@ -40,7 +46,16 @@ func main() {
|
|||
if app.Setup(func() {
|
||||
|
||||
//load core modules first
|
||||
modules.Register()
|
||||
module.RegisterSystemModule(elastic2.ElasticModule{})
|
||||
module.RegisterSystemModule(filter.FilterModule{})
|
||||
module.RegisterSystemModule(&stats.SimpleStatsModule{})
|
||||
module.RegisterSystemModule(&queue.DiskQueue{})
|
||||
module.RegisterSystemModule(&queue.RedisModule{})
|
||||
module.RegisterSystemModule(&queue.QueueModule{})
|
||||
module.RegisterSystemModule(&ui.UIModule{})
|
||||
module.RegisterSystemModule(&pipeline.PipeModule{})
|
||||
module.RegisterSystemModule(&task.TaskModule{})
|
||||
|
||||
pipe.RegisterProcessorPlugin("json_indexing", json_indexing.New)
|
||||
module.RegisterUserPlugin(&metrics.MetricsModule{})
|
||||
|
||||
|
|
7
ui.go
7
ui.go
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
log "github.com/cihub/seelog"
|
||||
"infini.sh/framework/core/api"
|
||||
"infini.sh/framework/core/ui"
|
||||
"infini.sh/framework/core/util"
|
||||
"infini.sh/framework/core/vfs"
|
||||
uiapi "infini.sh/search-center/api"
|
||||
|
@ -27,7 +26,7 @@ func (h UI) InitUI() {
|
|||
|
||||
vfs.RegisterFS(public.StaticFS{StaticFolder: h.Config.UI.LocalPath, TrimLeftPath: h.Config.UI.LocalPath, CheckLocalFirst: h.Config.UI.LocalEnabled, SkipVFS: !h.Config.UI.VFSEnabled})
|
||||
|
||||
ui.HandleUI("/", vfs.FileServer(vfs.VFS()))
|
||||
api.HandleUI("/", vfs.FileServer(vfs.VFS()))
|
||||
|
||||
uiapi.Init(h.Config)
|
||||
|
||||
|
@ -37,14 +36,14 @@ func (h UI) InitUI() {
|
|||
apiEndpoint = fmt.Sprintf("%s://%s", apiConfig.GetSchema(), apiConfig.NetworkConfig.GetPublishAddr())
|
||||
}
|
||||
|
||||
ui.HandleUIFunc("/config", func(w http.ResponseWriter, req *http.Request){
|
||||
api.HandleUIFunc("/config", func(w http.ResponseWriter, req *http.Request){
|
||||
buf, _ := json.Marshal(util.MapStr{
|
||||
"api_endpoint": apiEndpoint,
|
||||
})
|
||||
w.Write(buf)
|
||||
})
|
||||
|
||||
ui.HandleUIFunc("/api/", func(w http.ResponseWriter, req *http.Request) {
|
||||
api.HandleUIFunc("/api/", func(w http.ResponseWriter, req *http.Request) {
|
||||
log.Warn("api: ", req.URL, " not implemented")
|
||||
request, err := h.GetRawBody(req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue