Skip to content

Commit

Permalink
docker info suppports case-insensitive proxy env settings
Browse files Browse the repository at this point in the history
Signed-off-by: Kenjiro Nakayama <[email protected]>
  • Loading branch information
nak3 committed Nov 18, 2015
1 parent c00c64c commit 84781a5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions daemon/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package daemon
import (
"os"
"runtime"
"strings"
"time"

"github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -91,9 +92,9 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
ServerVersion: dockerversion.Version,
ClusterStore: daemon.config().ClusterStore,
ClusterAdvertise: daemon.config().ClusterAdvertise,
HTTPProxy: os.Getenv("http_proxy"),
HTTPSProxy: os.Getenv("https_proxy"),
NoProxy: os.Getenv("no_proxy"),
HTTPProxy: getProxyEnv("http_proxy"),
HTTPSProxy: getProxyEnv("https_proxy"),
NoProxy: getProxyEnv("no_proxy"),
}

// TODO Windows. Refactor this more once sysinfo is refactored into
Expand Down Expand Up @@ -129,3 +130,13 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {

return pluginsInfo
}

// The uppercase and the lowercase are available for the proxy settings.
// See the Go specification for details on these variables. https://golang.org/pkg/net/http/
func getProxyEnv(key string) string {
proxyValue := os.Getenv(strings.ToUpper(key))
if proxyValue == "" {
return os.Getenv(strings.ToLower(key))
}
return proxyValue
}

0 comments on commit 84781a5

Please sign in to comment.