teamxenox / devtocli

👩🏻‍💻 Browse and Search Dev.to Posts from Command Line
https://teamxenox.github.io/devtocli/
MIT License
142 stars 9 forks source link

Respect HTTP and HTTPS proxy environment variables #11

Closed jbutz closed 5 years ago

jbutz commented 5 years ago

Closes #5

In many corporate environments all web traffic must travel through a proxy server. For the *nix command line that generally means HTTP_PROXY or HTTPS_PROXY environment variables are set and expected to be used by applications.

This PR adds support for the proxy environment variables, both uppercase and lowercase. The ecosystem is inconsistent as to which case is best practice, so I generally support both.

Support is added to the xray calls by setting the global Agent property for the http and https modules. This ensures that any library that eventually uses those libraries will make use of the agent defined for the proxy.

As a side-note, I had originally implemented this using the request-x-ray driver. This method seems much cleaner.

sarthology commented 5 years ago

Great Job.