diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2016-11-22 16:53:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-22 16:53:45 -0500 |
commit | 2c31f94858d66464cc5acfd4dbe74777f2f83453 (patch) | |
tree | edc7757c2ff6dbd950de3f1d1f6ff77ca890c261 /src/rebar_config.erl | |
parent | 5f6d1d88acc2d8e228b569f6cc8d99da7fedbdf9 (diff) | |
parent | 5323fdc377d6034cdb625547600144881ae1af46 (diff) |
Merge pull request #1387 from ericmj/emj-rebar-config-env
Always read REBAR_CONFIG env var when loading config
Diffstat (limited to 'src/rebar_config.erl')
-rw-r--r-- | src/rebar_config.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/rebar_config.erl b/src/rebar_config.erl index 72bc6e9..5a35b87 100644 --- a/src/rebar_config.erl +++ b/src/rebar_config.erl @@ -26,7 +26,8 @@ %% ------------------------------------------------------------------- -module(rebar_config). --export([consult/1 +-export([consult/0 + ,consult/1 ,consult_app_file/1 ,consult_file/1 ,consult_lock_file/1 @@ -39,13 +40,19 @@ -include("rebar.hrl"). -include_lib("providers/include/providers.hrl"). +-define(DEFAULT_CONFIG_FILE, "rebar.config"). + %% =================================================================== %% Public API %% =================================================================== +-spec consult() -> [any()]. +consult() -> + consult_file(config_file()). + -spec consult(file:name()) -> [any()]. consult(Dir) -> - consult_file(filename:join(Dir, ?DEFAULT_CONFIG_FILE)). + consult_file(filename:join(Dir, config_file())). consult_app_file(File) -> consult_file_(File). @@ -298,3 +305,11 @@ check_newly_added_(Dep, LockedDeps) when is_atom(Dep) -> end; check_newly_added_(Dep, _) -> throw(?PRV_ERROR({bad_dep_name, Dep})). + +config_file() -> + case os:getenv("REBAR_CONFIG") of + false -> + ?DEFAULT_CONFIG_FILE; + ConfigFile -> + ConfigFile + end. |