From 3bd248f80f004c9764297f99bd632f9c7d7209ef Mon Sep 17 00:00:00 2001 From: liugq Date: Thu, 27 Oct 2022 10:20:18 +0800 Subject: [PATCH] add raw name of system cluster when initializing --- plugin/setup/setup.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/setup/setup.go b/plugin/setup/setup.go index 5671589e..258eb2b6 100644 --- a/plugin/setup/setup.go +++ b/plugin/setup/setup.go @@ -248,6 +248,7 @@ func (module *Module) initTempClient(r *http.Request) (error, elastic.API,SetupR cfg.Schema=uri.Scheme } + cfg.ID = tempID cfg.Name = "INFINI_SYSTEM ("+util.PickRandomName()+")" elastic.InitMetadata(&cfg, true) @@ -256,10 +257,18 @@ func (module *Module) initTempClient(r *http.Request) (error, elastic.API,SetupR return err,nil,request } + global.Register(elastic.GlobalSystemElasticsearchID,tempID) + elastic.UpdateConfig(cfg) elastic.UpdateClient(cfg, client) + health, err := client.ClusterHealth() + if err != nil { + return err,nil,request + } + if health != nil { + cfg.RawName = health.Name + } cfg.Version=client.GetVersion() - global.Register(elastic.GlobalSystemElasticsearchID,tempID) return err, client,request }