Browse Source

广东矿山项目增加es请求用户名密码设置

dev
zhangyuxiang 1 week ago
parent
commit
56183b4778
  1. 3
      consumers/consumerGDKS.go
  2. 4
      dbOperate/httpHelper.go

3
consumers/consumerGDKS.go

@ -51,11 +51,12 @@ func (the *consumerGDKS) InputInitial() error {
HttpClient: &dbOperate.HttpHelper{Url: the.ConfigInfo.IoConfig.In.Http.Url, Token: ""},
MonitorHelper: &monitors.MonitorHelper{CronStr: the.ConfigInfo.IoConfig.In.CronStr},
}
the.InHttp.HttpClient.SetAuth(the.ConfigInfo.IoConfig.In.Http.Username, the.ConfigInfo.IoConfig.In.Http.Password)
the.InHttp.Start()
the.InHttp.RegisterTask(the.ConfigInfo.IoConfig.In.CronStr, the.getEsData)
return nil
}
func (the *consumerGDKS) OutputInitial() error {
//数据出口
the.OutFile = &dbOperate.FileSaveHelper{

4
dbOperate/httpHelper.go

@ -93,7 +93,9 @@ func (the *HttpHelper) HttpGetWithHeader(queryBody string, headerMap map[string]
for k, v := range headerMap {
req.Header.Set(k, v)
}
if the.userName != "" && the.passWord != "" {
req.SetBasicAuth(the.userName, the.passWord)
}
//取消证书校验,避免证书过期问题
client.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}

Loading…
Cancel
Save