diff --git a/consumers/consumerGDKS.go b/consumers/consumerGDKS.go index a48f8e8..ccc4378 100644 --- a/consumers/consumerGDKS.go +++ b/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{ diff --git a/dbOperate/httpHelper.go b/dbOperate/httpHelper.go index 3c3a886..5151174 100644 --- a/dbOperate/httpHelper.go +++ b/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}}