-
Notifications
You must be signed in to change notification settings - Fork 273
/
proxy.go
41 lines (34 loc) 路 844 Bytes
/
proxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package framework
import (
"os"
"strings"
"github.com/aws/eks-anywhere/internal/pkg/api"
)
const (
httpProxyVar = "T_HTTP_PROXY"
httpsProxyVar = "T_HTTPS_PROXY"
noProxyVar = "T_NO_PROXY"
)
var proxyRequiredEnvVars = []string{
httpProxyVar,
httpsProxyVar,
noProxyVar,
}
func WithProxy() ClusterE2ETestOpt {
return func(e *ClusterE2ETest) {
checkRequiredEnvVars(e.T, proxyRequiredEnvVars)
httpProxy := os.Getenv(httpProxyVar)
httpsProxy := os.Getenv(httpsProxyVar)
noProxies := os.Getenv(noProxyVar)
var noProxy []string
for _, data := range strings.Split(noProxies, ",") {
noProxy = append(noProxy, strings.TrimSpace(data))
}
e.clusterFillers = append(e.clusterFillers,
api.WithProxyConfig(httpProxy, httpsProxy, noProxy),
)
}
}
func RequiredProxyEnvVars() []string {
return proxyRequiredEnvVars
}