tomnomnom / gron

Make JSON greppable!
MIT License
13.73k stars 325 forks source link

Add proxy capabilities #101

Open dotcs opened 2 years ago

dotcs commented 2 years ago

This PR adds support for using a proxy when calling gron <url>. It allows to configure a proxy through the environment variables http_proxy and https_proxy and also respects values in the no_proxy environment variables. Users can always overwrite environment variables by using the two new cli arguments -x/--proxy or --noproxy to overwrite the environment variables (e.g., to disable the proxy). The behavior is similar to curl's behavior.

This PR fixes #89.

It's currently unclear to me if we should add some docs to this - either directly in the Readme or maybe in the advanced section.

Please note: In difference to the behavior of curl, I don't have an option to configure an ALL_PROXY environment variable. Also I don't support an asterisk symbol in the no_proxy environment variable to deactivate the proxy, simply because in this case http_proxy=""/https_proxy="" or gron --proxy "" <url> could be used instead.