diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2019-06-30 16:03:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-30 16:03:43 -0400 |
commit | 0d9e5bb37d82a116975be7925ae7a4ca8c8d12bb (patch) | |
tree | 05fea79b77a5045da4dc936f86b05e1c9cf1e7e8 /src/rebar_dir.erl | |
parent | d752e2787007991d59de143087bf9bafe47e0402 (diff) | |
parent | 4fdf2fe089cc9d48c462179898fde20ba2217ceb (diff) |
Merge pull request #2060 from starbelly/rebar_config_env_variable
Support rebar config dir env var
Diffstat (limited to 'src/rebar_dir.erl')
-rw-r--r-- | src/rebar_dir.erl | 11 |
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(). |