Browse Source

支持配置es密码

dev
liutong 2 weeks ago
parent
commit
85db6f546a
  1. 10
      consumers/consumerCDJYSN.go

10
consumers/consumerCDJYSN.go

@ -52,6 +52,14 @@ func (the *consumerCDJYSN) InputInitial() error {
MonitorHelper: &monitors.MonitorHelper{CronStr: the.ConfigInfo.IoConfig.In.CronStr},
}
httpConfig := the.ConfigInfo.IoConfig.In.Http
userName, password := httpConfig.Username, httpConfig.Password
// 兼容未配置认证信息的旧配置文件。
if userName == "" && password == "" {
userName, password = "admin", "q^!5uyXF5sbI"
}
the.InHttp.HttpClient.SetAuth(userName, password)
the.InHttp.Start()
the.InHttp.RegisterTask(the.ConfigInfo.IoConfig.In.CronStr, the.getEsData)
return nil
@ -301,8 +309,6 @@ func (the *consumerCDJYSN) getEsData() {
}
}
`, structureId, start, end)
//auth := map[string]string{"Authorization": "Basic YWRtaW46cV4hNXV5WEY1c2JJ"}
the.InHttp.HttpClient.SetAuth("admin", "q^!5uyXF5sbI")
esAggResult := the.InHttp.HttpClient.HttpGet(esQuery)
var needPush []byte

Loading…
Cancel
Save