github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/juju/osenv/proxy_linux.go (about) 1 package osenv 2 3 import ( 4 "os" 5 "strings" 6 ) 7 8 func getProxySetting(key string) string { 9 value := os.Getenv(key) 10 if value == "" { 11 value = os.Getenv(strings.ToUpper(key)) 12 } 13 return value 14 } 15 16 // SetEnvironmentValues updates the process environment with the 17 // proxy values stored in the settings object. Both the lower-case 18 // and upper-case variants are set. 19 // 20 // http_proxy, HTTP_PROXY 21 // https_proxy, HTTPS_PROXY 22 // ftp_proxy, FTP_PROXY 23 func (s *ProxySettings) SetEnvironmentValues() { 24 setenv := func(proxy, value string) { 25 os.Setenv(proxy, value) 26 os.Setenv(strings.ToUpper(proxy), value) 27 } 28 setenv(http_proxy, s.Http) 29 setenv(https_proxy, s.Https) 30 setenv(ftp_proxy, s.Ftp) 31 setenv(no_proxy, s.NoProxy) 32 }