summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar.hrl1
-rw-r--r--src/rebar3.erl7
-rw-r--r--src/rebar_config.erl19
3 files changed, 18 insertions, 9 deletions
diff --git a/src/rebar.hrl b/src/rebar.hrl
index f96ed5e..c94a84a 100644
--- a/src/rebar.hrl
+++ b/src/rebar.hrl
@@ -22,7 +22,6 @@
-define(DEFAULT_PLUGINS_DIR, "plugins").
-define(DEFAULT_TEST_DEPS_DIR, "test/lib").
-define(DEFAULT_RELEASE_DIR, "rel").
--define(DEFAULT_CONFIG_FILE, "rebar.config").
-define(CONFIG_VERSION, "1.1.0").
-define(DEFAULT_CDN, "https://repo.hex.pm/").
-define(REMOTE_PACKAGE_DIR, "tarballs").
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 47dc25a..4e7e284 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -149,12 +149,7 @@ init_config() ->
Verbosity = log_level(),
ok = rebar_log:init(command_line, Verbosity),
- Config = case os:getenv("REBAR_CONFIG") of
- false ->
- rebar_config:consult_file(?DEFAULT_CONFIG_FILE);
- ConfigFile ->
- rebar_config:consult_file(ConfigFile)
- end,
+ Config = rebar_config:consult(),
Config1 = rebar_config:merge_locks(Config, rebar_config:consult_lock_file(?LOCK_FILE)),
%% If $HOME/.config/rebar3/rebar.config exists load and use as global config
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.