refactor: misc refactoring (#289)

Reviewed-on: https://git.infini.ltd/infini/console/pulls/289
This commit is contained in:
medcl 2024-02-01 14:41:54 +08:00
parent 50f12de6a8
commit 597fa16369
4 changed files with 5 additions and 7 deletions

View File

@ -3,7 +3,7 @@
set -eo pipefail
function print_usage() {
echo "Usage: curl -sSL http://$[[CLOUD_ENDPOINT]]/instance/_get_install_script?token | sudo bash -s -- [-u url_for_download_program] [-v version_for_program ] [-t target_install_dir] [-o overwite_flag] [-s url_console_lan_adress]"
echo "Usage: curl -ksSL http://$[[CLOUD_ENDPOINT]]/instance/_get_install_script?token | sudo bash -s -- [-u url_for_download_program] [-v version_for_program ] [-t target_install_dir] [-o overwite_flag] [-s url_console_lan_adress]"
echo "Options:"
echo " -u, --url <url> Install Agent download URL, format is schema://domain:port/stable/agent-platform-version.ext, can be manually specified"
echo " -v, --version <version> Install Agent version, default is to get latest version online, can be manually specified"

View File

@ -186,7 +186,7 @@ func GetElasticsearchNodesViaAgent(ctx context.Context, endpoint string) (*elast
}
obj := elastic.DiscoveryResult{}
_, err := server.ProxyAgentRequest(endpoint, req, &obj)
_, err := server.ProxyAgentRequest("elasticsearch",endpoint, req, &obj)
if err != nil {
return nil, err
}
@ -218,7 +218,7 @@ func GetElasticLogFiles(ctx context.Context, instance *model.Instance, logsPath
}
resBody := map[string]interface{}{}
_, err := server.ProxyAgentRequest(instance.GetEndpoint(), req, &resBody)
_, err := server.ProxyAgentRequest("elasticsearch",instance.GetEndpoint(), req, &resBody)
if err != nil {
return nil, err
}
@ -237,7 +237,7 @@ func GetElasticLogFileContent(ctx context.Context, instance *model.Instance, bod
Body: util.MustToJSONBytes(body),
}
resBody := map[string]interface{}{}
_, err := server.ProxyAgentRequest(instance.GetEndpoint(), req, &resBody)
_, err := server.ProxyAgentRequest("elasticsearch",instance.GetEndpoint(), req, &resBody)
if err != nil {
return nil, err
}
@ -651,7 +651,7 @@ func (h *APIHandler) getESNodeInfoViaProxyWithConfig(cfg *elastic.ElasticsearchC
}
obj := elastic.LocalNodeInfo{}
res, err := server.ProxyAgentRequest(endpoint, req, &obj)
res, err := server.ProxyAgentRequest("elasticsearch",endpoint, req, &obj)
if err != nil {
if global.Env().IsDebug {
log.Error(err)

View File

@ -17,7 +17,6 @@ func GetAgentConfig() *model.AgentConfig {
Enabled: true,
Setup: &model.SetupConfig{
DownloadURL: "https://release.infinilabs.com/agent/stable",
Version: "0.7.0-364",
},
}
_, err := env.ParseConfig("agent", agentCfg )

View File

@ -11,7 +11,6 @@ type AgentConfig struct {
type SetupConfig struct {
DownloadURL string `config:"download_url"`
Version string `config:"version"`
CACertFile string `config:"ca_cert"`
CAKeyFile string `config:"ca_key"`
ConsoleEndpoint string `config:"console_endpoint"`