From 56183b477808eda84652dfb5c3a1cdf01697c6f6 Mon Sep 17 00:00:00 2001 From: zhangyuxiang <1323804152@qq.com> Date: Tue, 28 Jul 2026 13:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BF=E4=B8=9C=E7=9F=BF=E5=B1=B1=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=A2=9E=E5=8A=A0es=E8=AF=B7=E6=B1=82=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consumers/consumerGDKS.go | 3 ++- dbOperate/httpHelper.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) 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}}