-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add proxy support to bootstrap and rebar3. Enhancement #561. #579
Conversation
It shouldn't be os vars. In the plugin they are read from the hex config, https://github.com/hexpm/rebar3_hex/blob/master/src/rebar3_hex_config.erl#L97 We either should always look in that file or we can support them being set in |
On rebar3 I believe reading from ~/.config/rebar3/rebar.config is fine but on bootstrap I think it would be better to read OS default since rebar is not even installed in the machine. |
I don't like the use of os vars, even in bootstrap. But I'd be fine with bootstrap looking in ./rebar.config or taking the proxy as an argument. What do you think of one of those options? In Also, can you simplify the logic by copying how it is done in rebar3_hex, https://github.com/hexpm/rebar3_hex/blob/master/src/rebar3_hex_http.erl#L107-L115 |
What about first check ~/.config/rebar3/rebar.config for the vars. If not present check OS. I would implement on both bootstrap and rebar3. No need to change rebar3 rebar.config. The person building it would need to add the vars to it's own ~/.config/rebar3/rebar.config. |
I still don't think we should ever look at any OS vars. We don't use them for anything besides |
The way I left is that the user must configure proxy vars on both ~/.config/rebar3/rebar.config and ~/.hex/hex.config. Is this the desired way to have it? |
Looking good. But you should use |
Sorry about that.. I don't know the rebar API very well. Found the problem with the failing tests. The "hex" profile on httpc is not needed anymore. Fixed the test cases and will push in a couple minutes. |
Oh right, can you actually change that to using a |
You mean replacing the "hex" profile for "rebar" on httpc calls? No problem. |
Yup, replacing hex with rebar in httpc calls. And yea, in bootstrap that is fine. |
Also whatever happens, this stuff needs tests. |
@ferd how would you test this with out either setting up a proxy for the test or mocking internal parts of httpc? |
At the very least, we should trust |
Ah, wait, duh, in a test it can just use |
Any news when this will be merged? |
It looks good, but could you add a simple test, probably in |
{ok, {{_Version, 200, _Reason}, _Headers, Body}} -> | ||
{ok, Body}; | ||
Error -> | ||
Error | ||
end. | ||
|
||
get_rebar_config() -> | ||
{ok, [[Home]]} = init:get_argument(home), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferd no, you can't do that in bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just realized and tried to flush my comments. Saw it was fine later in the actual file.
I'm having problems with the tests. The scenario gets the variable from my own configured file and not the values injected into the mock config: I created them in rebar_pkg_SUITE since I saw similar httpc tests on it:
But when I check the result, it gets my rebar.config values instead of the values above:
Can you help me out? |
The What you probably want to mock instead will be for You can then have your test call As part of the |
Oops.. I don't know why the robocopy fix went into this pull request. Need to remove it. |
…ead from environment vars http_proxy and https_proxy.
… {http_proxy, http://host:port} or {http_proxy, http://host:port}
That's it. Fixed the branch (removed the two wrong commits). |
The tests are failing on R15B03 because httpc module did not support https_proxy, only proxy. |
I'm guessing we'd have to detect in init_per_testcase whether the OTP version is R15Bxx (or prior) and if so, return |
Don't know why Travis still fails on R15 even when checking if OTP Vsn is =<15. |
@carlosedp cherry-pick this commit and it will work: ferd@74c6847 |
Thanks @ferd. It's passing now. |
Add proxy support to bootstrap and rebar3. Enhancement #561.
Could you explain why not honoring os env var without the |
Add proxy support to bootstrap and rebar3.
Either bootstrap and rebar3 now uses environment variables http_proxy and https_proxy to fetch dependency packages and hex plugins.
Enhancement #561.