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

Commit 1fdd862

Browse files
committed
daemon/info: remove use of docker/go-connections
The `docker/go-connections` package was only used for a quite generic utility. This patch removes the use of the package by replacing the `GetProxyEnv` utility with a local function that's based on the one in golang.org/x/net/http/httpproxy: https://github.com/golang/net/blob/c21de06aaf072cea07f3a65d6970e5c7d8b6cd6d/http/httpproxy/proxy.go#L100-L107 Signed-off-by: Sebastiaan van Stijn <[email protected]> Upstream-commit: 0f0e3163b5278e7eb047313d22c645fbaee26884 Component: engine
1 parent 00dd6dc commit 1fdd862

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)