add raw name of system cluster when initializing

This commit is contained in:
liugq 2022-10-27 10:20:18 +08:00
parent 2609e51623
commit 3bd248f80f
1 changed files with 10 additions and 1 deletions

View File

@ -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
}