removeEmptyStrings is a utility function for removing empty fields from a proxy configuration. This is required to allow overriding
(proxyConfig *controller.Proxy)
| 97 | // removeEmptyStrings is a utility function for removing empty fields from a proxy configuration. This is required |
| 98 | // to allow overriding |
| 99 | func removeEmptyStrings(proxyConfig *controller.Proxy) *controller.Proxy { |
| 100 | if proxyConfig == nil { |
| 101 | return nil |
| 102 | } |
| 103 | |
| 104 | updated := &controller.Proxy{} |
| 105 | if proxyConfig.HttpProxy != nil && *proxyConfig.HttpProxy != "" { |
| 106 | updated.HttpProxy = proxyConfig.HttpProxy |
| 107 | } |
| 108 | if proxyConfig.HttpsProxy != nil && *proxyConfig.HttpsProxy != "" { |
| 109 | updated.HttpsProxy = proxyConfig.HttpsProxy |
| 110 | } |
| 111 | if proxyConfig.NoProxy != nil && *proxyConfig.NoProxy != "" { |
| 112 | updated.NoProxy = proxyConfig.NoProxy |
| 113 | } |
| 114 | return updated |
| 115 | } |