diff --git a/hostinfo/info.go b/hostinfo/info.go index e6a2302..7d7f8f9 100644 --- a/hostinfo/info.go +++ b/hostinfo/info.go @@ -2,6 +2,7 @@ package hostinfo import ( "fmt" + "os" "strings" ) @@ -55,12 +56,23 @@ func LoadHostInfo() (*HostInfo, error) { } func (hi *HostInfo) String() string { + httpProxy := os.Getenv("HTTP_PROXY") + httpsProxy := os.Getenv("HTTPS_PROXY") + + proxyInfo := "No proxy set" + if httpProxy != "" { + proxyInfo = fmt.Sprintf("HTTP_PROXY: %s", httpProxy) + } else if httpsProxy != "" { + proxyInfo = fmt.Sprintf("HTTPS_PROXY: %s", httpsProxy) + } + return strings.Join( []string{ "HostInfo:", fmt.Sprintf("| CpuCount: %d", hi.CpuCount), fmt.Sprintf("| HostName: %s", hi.HostName), fmt.Sprintf("| HostId: %s", hi.HostId), + fmt.Sprintf("| Proxy: %s", proxyInfo), fmt.Sprintf("| ExternalOrganization: %s", hi.ExternalOrganization), fmt.Sprintf("| SocketCount: %s", hi.SocketCount), fmt.Sprintf("| Product: %s", hi.Product), diff --git a/hostinfo/info_test.go b/hostinfo/info_test.go index 233df27..fb44322 100644 --- a/hostinfo/info_test.go +++ b/hostinfo/info_test.go @@ -24,6 +24,7 @@ func TestHostInfo(t *testing.T) { "| CpuCount: 64\n" + "| HostName: host.mock.test\n" + "| HostId: 01234567-89ab-cdef-0123-456789abcdef\n" + + "| Proxy: No proxy set\n" + "| ExternalOrganization: 12345678\n" + "| SocketCount: 3\n" + "| Product: [394 69]\n" +