File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,6 +119,23 @@ func buildTransport(opts ClientOpts, flags *Flags) http.RoundTripper {
119119 return transport
120120}
121121
122+ // envProxyURL resolves the proxy URL
123+ // from standard HTTP_PROXY/HTTPS_PROXY/NO_PROXY
124+ // environment variables for the given endpoint.
125+ // Returns nil if the endpoint is not a valid URL,
126+ // no proxy is configured, or the endpoint is excluded.
127+ func envProxyURL (endpoint string ) * url.URL {
128+ u , err := url .Parse (endpoint )
129+ if err != nil || u .Scheme == "" || u .Host == "" {
130+ return nil
131+ }
132+ proxyURL , err := http .ProxyFromEnvironment (& http.Request {URL : u })
133+ if err != nil || proxyURL == nil {
134+ return nil
135+ }
136+ return proxyURL
137+ }
138+
122139// NewClient creates a new API client.
123140func NewClient (opts ClientOpts ) Client {
124141 if opts .Out == nil {
You can’t perform that action at this time.
0 commit comments