From 08f8a9970e37147b73fc7fb1a8e0224c7e123a2b Mon Sep 17 00:00:00 2001 From: bakito Date: Mon, 14 Feb 2022 18:40:17 +0100 Subject: [PATCH] extract to constant - fixes #59 --- pkg/client/client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 3210b6d..9929001 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -16,6 +16,8 @@ import ( "go.uber.org/zap" ) +const envRedirectPolicyNoOfRedirects = "REDIRECT_POLICY_NO_OF_REDIRECTS" + var ( l = log.GetLogger("client") // ErrSetupNeeded custom error @@ -46,10 +48,10 @@ func New(config types.AdGuardInstance) (Client, error) { cl = cl.SetBasicAuth(config.Username, config.Password) } - if v, ok := os.LookupEnv("REDIRECT_POLICY_NO_OF_REDIRECTS"); ok { + if v, ok := os.LookupEnv(envRedirectPolicyNoOfRedirects); ok { nbr, err := strconv.Atoi(v) if err != nil { - return nil, fmt.Errorf("error parsing env var %q value must be an integer", "REDIRECT_POLICY_NO_OF_REDIRECTS") + return nil, fmt.Errorf("error parsing env var %q value must be an integer", envRedirectPolicyNoOfRedirects) } cl.SetRedirectPolicy(resty.FlexibleRedirectPolicy(nbr)) } else {