summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 56a3940..aa9e268 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -69,7 +69,8 @@
check_blacklisted_otp_versions/1,
info_useless/2,
list_dir/1,
- user_agent/0]).
+ user_agent/0,
+ reread_config/1]).
%% for internal use only
-export([otp_release/0]).
@@ -412,6 +413,17 @@ user_agent() ->
{ok, Vsn} = application:get_key(rebar, vsn),
?FMT("Rebar/~s (OTP/~s)", [Vsn, otp_release()]).
+reread_config(ConfigList) ->
+ try
+ [application:set_env(Application, Key, Val)
+ || Config <- ConfigList,
+ {Application, Items} <- Config,
+ {Key, Val} <- Items]
+ catch _:_ ->
+ ?ERROR("The configuration file submitted could not be read "
+ "and will be ignored.", [])
+ end.
+
%% ====================================================================
%% Internal functions
%% ====================================================================
@@ -789,9 +801,13 @@ maybe_ends_in_comma(H) ->
end.
get_http_vars(Scheme) ->
+ OS = case os:getenv(atom_to_list(Scheme)) of
+ Str when is_list(Str) -> Str;
+ _ -> []
+ end,
GlobalConfigFile = rebar_dir:global_config(),
Config = rebar_config:consult_file(GlobalConfigFile),
- proplists:get_value(Scheme, Config, []).
+ proplists:get_value(Scheme, Config, OS).
set_httpc_options() ->
set_httpc_options(https_proxy, get_http_vars(https_proxy)),