From fff9caeca6429effe0cf5b6df3d0b8e1a2b35d32 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 7 Jan 2022 07:06:57 -0500 Subject: [PATCH] WEB Proxy is used in at least three different places in code This change makes a global rather then defining this list in multiple places. [NO NEW TESTS NEEDED] Signed-off-by: Daniel J Walsh --- pkg/config/config.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index f419601e9..70cc810b1 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -48,6 +48,17 @@ const ( BoltDBStateStore RuntimeStateStore = iota ) +var ProxyEnvMap = map[string]bool{ + "http_proxy": true, + "https_proxy": true, + "ftp_proxy": true, + "no_proxy": true, + "HTTP_PROXY": true, + "HTTPS_PROXY": true, + "FTP_PROXY": true, + "NO_PROXY": true, +} + // Config contains configuration options for container tools type Config struct { // Containers specify settings that configure how containers will run ont the system @@ -897,8 +908,7 @@ func (c *Config) GetDefaultEnvEx(envHost, httpProxy bool) []string { if envHost { env = append(env, os.Environ()...) } else if httpProxy { - proxy := []string{"http_proxy", "https_proxy", "ftp_proxy", "no_proxy", "HTTP_PROXY", "HTTPS_PROXY", "FTP_PROXY", "NO_PROXY"} - for _, p := range proxy { + for p := range ProxyEnvMap { if val, ok := os.LookupEnv(p); ok { env = append(env, fmt.Sprintf("%s=%s", p, val)) }