aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_prv_config.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2012-12-30 19:15:01 -0500
committerEric <[email protected]>2012-12-30 19:15:01 -0500
commit78ec90ae6084f44b5379bd4e9eebb79746f4a595 (patch)
tree124b7b8c8e22c0b93fbb0d538bcff349dac0b283 /src/rcl_prv_config.erl
parentfbf58da536939dece9a6707b7ff39e12bf377d1c (diff)
downloadrelx-78ec90ae6084f44b5379bd4e9eebb79746f4a595.tar.gz
relx-78ec90ae6084f44b5379bd4e9eebb79746f4a595.tar.bz2
relx-78ec90ae6084f44b5379bd4e9eebb79746f4a595.zip
support only one config file in the system
Diffstat (limited to 'src/rcl_prv_config.erl')
-rw-r--r--src/rcl_prv_config.erl14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/rcl_prv_config.erl b/src/rcl_prv_config.erl
index 7ea9a77..f87c467 100644
--- a/src/rcl_prv_config.erl
+++ b/src/rcl_prv_config.erl
@@ -29,11 +29,11 @@ init(State) ->
%% populating the state as a result.
-spec do(rcl_state:t()) ->{ok, rcl_state:t()} | relcool:error().
do(State) ->
- case rcl_state:config_files(State) of
+ case rcl_state:config_file(State) of
[] ->
search_for_dominating_config(State);
- ConfigFiles ->
- lists:foldl(fun load_config/2, {ok, State}, ConfigFiles)
+ ConfigFile ->
+ load_config(ConfigFile, State)
end.
-spec format_error(Reason::term()) -> iolist().
@@ -63,7 +63,7 @@ search_for_dominating_config(State0) ->
%% we need to set the root dir on state as well
{ok, RootDir} = parent_dir(Config),
State1 = rcl_state:root_dir(State0, RootDir),
- load_config(Config, {ok, rcl_state:config_files(State1, [Config])});
+ load_config(Config, rcl_state:config_file(State1, Config));
no_config ->
{ok, State0}
end.
@@ -88,11 +88,9 @@ parent_dir([H | T], Acc) ->
parent_dir(T, [H | Acc]).
--spec load_config(file:filename(), {ok, rcl_state:t()} | relcool:error()) ->
+-spec load_config(file:filename(), rcl_state:t()) ->
{ok, rcl_state:t()} | relcool:error().
-load_config(_, Err = {error, _}) ->
- Err;
-load_config(ConfigFile, {ok, State}) ->
+load_config(ConfigFile, State) ->
{ok, CurrentCwd} = file:get_cwd(),
ok = file:set_cwd(filename:dirname(ConfigFile)),
Result = case file:consult(ConfigFile) of