summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Paxton <starbelly@pobox.com>2019-04-22 21:11:51 -0500
committerBryan Paxton <starbelly@pobox.com>2019-06-30 14:09:11 -0500
commit4fdf2fe089cc9d48c462179898fde20ba2217ceb (patch)
tree05fea79b77a5045da4dc936f86b05e1c9cf1e7e8 /src
parentd752e2787007991d59de143087bf9bafe47e0402 (diff)
Support rebar config dir env var
Diffstat (limited to 'src')
-rw-r--r--src/rebar_dir.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl
index 17bc48e..aac6210 100644
--- a/src/rebar_dir.erl
+++ b/src/rebar_dir.erl
@@ -107,8 +107,15 @@ home_dir() ->
%% may be stored.
-spec global_config_dir(rebar_state:t()) -> file:filename_all().
global_config_dir(State) ->
- Home = home_dir(),
- rebar_state:get(State, global_rebar_dir, filename:join([Home, ".config", "rebar3"])).
+ filename:join([rebar_config_dir(State), ".config", "rebar3"]).
+
+rebar_config_dir(State) ->
+ case os:getenv("REBAR_GLOBAL_CONFIG_DIR") of
+ false ->
+ rebar_state:get(State, global_rebar_dir, home_dir());
+ ConfDir ->
+ ConfDir
+ end.
%% @doc returns the path of the global rebar.config file
-spec global_config(rebar_state:t()) -> file:filename_all().