Skip to content

Commit

Permalink
Merge pull request #2748 from dmitrivereshchagin/hex-mirror
Browse files Browse the repository at this point in the history
Respect HEX_MIRROR environment variable
  • Loading branch information
ferd committed Oct 2, 2022
2 parents d8d5e02 + 8b85ab2 commit feb4a91
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/rebar/src/rebar3.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ run_aux(State, RawArgs) ->
rebar_utils:check_blacklisted_otp_versions(rebar_state:get(State1, blacklisted_otp_vsns, undefined)),

%% Maybe change the default hex CDN
State2 = case os:getenv("HEX_CDN", "") of
State2 = case hex_cdn() of
"" ->
State1;
CDN ->
Expand Down Expand Up @@ -486,3 +486,14 @@ test_defined([{d, 'TEST'}|_]) -> true;
test_defined([{d, 'TEST', true}|_]) -> true;
test_defined([_|Rest]) -> test_defined(Rest);
test_defined([]) -> false.

-spec hex_cdn() -> os:env_var_value().
hex_cdn() ->
case os:getenv("HEX_CDN") of
false ->
%% Checking HEX_MIRROR can be useful when compiling dependencies
%% in a project managed by Mix.
os:getenv("HEX_MIRROR", "");
CDN ->
CDN
end.

0 comments on commit feb4a91

Please sign in to comment.