Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Add support for env vars by default (#11)#16

Merged
TooTallNate merged 2 commits intoTooTallNate:masterfrom
jackjocross:feature/use-env-vars
Feb 14, 2018
Merged

Add support for env vars by default (#11)#16
TooTallNate merged 2 commits intoTooTallNate:masterfrom
jackjocross:feature/use-env-vars

Conversation

@jackjocross
Copy link
Copy Markdown
Contributor

@jackjocross jackjocross commented Jan 11, 2018

If you declare a new ProxyAgent() without passing any opts, proxy-from-env will be used to determine whether to use a proxy or the default http.Agent.

In order to support the NO_PROXY environment variable, I had to add some logic in the connect function to resolve the proxy for each request if initial opts weren't passed in.

I am not very familiar with http.Agent, but tried using agent.addRequest after reading through the source code. Let me know if you think I should take a different approach to anything in this PR.

Comment thread index.js Outdated
function httpOrHttps(opts, secureEndpoint) {
if (secureEndpoint) {
// HTTPS
return new HttpsAgent();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should use http.globalAgent and https.globalAgent instead 🤔

@jackjocross
Copy link
Copy Markdown
Contributor Author

@TooTallNate let me know if there are any other changes I should make!

@TooTallNate
Copy link
Copy Markdown
Owner

Really good stuff @crosscompile! Thank you.

@TooTallNate TooTallNate merged commit 787ede0 into TooTallNate:master Feb 14, 2018
@pimterry
Copy link
Copy Markdown

pimterry commented Apr 4, 2018

I'd love to use this, but it doesn't look like it's actually been released. Any chance you could publish this sometime soon @TooTallNate?

@nhooyr
Copy link
Copy Markdown
Contributor

nhooyr commented Dec 18, 2020

Thank you for adding this @crosscompile! <3

Going to be super easy to support http proxies in https://github.com/cdr/code-server now!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants