From 2a877a2a3cbb967586015f482381b90214b9a0ee Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin <valyala@victoriametrics.com> Date: Thu, 30 Jun 2022 20:17:30 +0300 Subject: [PATCH] app/vmagent/remotewrite: do not shadow `headers` global variable in getAuthConfig --- app/vmagent/remotewrite/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/vmagent/remotewrite/client.go b/app/vmagent/remotewrite/client.go index 16e9ef5611..c466feea42 100644 --- a/app/vmagent/remotewrite/client.go +++ b/app/vmagent/remotewrite/client.go @@ -172,9 +172,9 @@ func (c *client) MustStop() { func getAuthConfig(argIdx int) (*promauth.Config, error) { headersValue := headers.GetOptionalArg(argIdx) - var headers []string + var hdrs []string if headersValue != "" { - headers = strings.Split(headersValue, "^^") + hdrs = strings.Split(headersValue, "^^") } username := basicAuthUsername.GetOptionalArg(argIdx) password := basicAuthPassword.GetOptionalArg(argIdx) @@ -212,7 +212,7 @@ func getAuthConfig(argIdx int) (*promauth.Config, error) { InsecureSkipVerify: tlsInsecureSkipVerify.GetOptionalArg(argIdx), } - authCfg, err := promauth.NewConfig(".", nil, basicAuthCfg, token, tokenFile, oauth2Cfg, tlsCfg, headers) + authCfg, err := promauth.NewConfig(".", nil, basicAuthCfg, token, tokenFile, oauth2Cfg, tlsCfg, hdrs) if err != nil { return nil, fmt.Errorf("cannot populate OAuth2 config for remoteWrite idx: %d, err: %w", argIdx, err) }