Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 3808b6e

Browse files
authored
Merge pull request #39985 from thaJeztah/inline_proxyenv
daemon/info: remove use of docker/go-connections Upstream-commit: b6684a403c99aaf6be5b8ce0bef3c6650fcdcd12 Component: engine
2 parents e83c6cd + 1fdd862 commit 3808b6e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

components/engine/daemon/info.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/docker/docker/pkg/sysinfo"
2121
"github.com/docker/docker/pkg/system"
2222
"github.com/docker/docker/registry"
23-
"github.com/docker/go-connections/sockets"
2423
metrics "github.com/docker/go-metrics"
2524
"github.com/sirupsen/logrus"
2625
)
@@ -66,9 +65,9 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
6665
ServerVersion: dockerversion.Version,
6766
ClusterStore: daemon.configStore.ClusterStore,
6867
ClusterAdvertise: daemon.configStore.ClusterAdvertise,
69-
HTTPProxy: maskCredentials(sockets.GetProxyEnv("http_proxy")),
70-
HTTPSProxy: maskCredentials(sockets.GetProxyEnv("https_proxy")),
71-
NoProxy: sockets.GetProxyEnv("no_proxy"),
68+
HTTPProxy: maskCredentials(getEnvAny("HTTP_PROXY", "http_proxy")),
69+
HTTPSProxy: maskCredentials(getEnvAny("HTTPS_PROXY", "https_proxy")),
70+
NoProxy: getEnvAny("NO_PROXY", "no_proxy"),
7271
LiveRestoreEnabled: daemon.configStore.LiveRestoreEnabled,
7372
Isolation: daemon.defaultIsolation,
7473
}
@@ -287,3 +286,12 @@ func maskCredentials(rawURL string) string {
287286
maskedURL := parsedURL.String()
288287
return maskedURL
289288
}
289+
290+
func getEnvAny(names ...string) string {
291+
for _, n := range names {
292+
if val := os.Getenv(n); val != "" {
293+
return val
294+
}
295+
}
296+
return ""
297+
}

0 commit comments

Comments
 (0)