Skip to content

Commit b69b86e

Browse files
committed
config: ensure {mode, ..} expansion does not override existing settings
also: do not export rlx_config:load/2 since it is unused at the moment see: erlang/rebar3#2853
1 parent b469a43 commit b69b86e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/rlx_config.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
-module(rlx_config).
22

33
-export([to_state/1,
4-
load/2,
54
format_error/1]).
65

76
-include("relx.hrl").
@@ -15,7 +14,11 @@
1514
to_state(Config) ->
1615
to_state(Config, rlx_state:new()).
1716

18-
to_state(Config, State) ->
17+
to_state(Config0, State) ->
18+
%% ensure 'mode' elements are at the head of the Config list,
19+
%% this makes it possible to override options the modes expand
20+
Modes = [V || {mode, _} = V <- Config0],
21+
Config = Modes ++ (Config0 -- Modes),
1922
%% setup warnings_as_errors before loading the rest so we can error on
2023
%% any warning during the load
2124
State1 = rlx_state:warnings_as_errors(State, proplists:get_bool(warnings_as_errors, Config)),

0 commit comments

Comments
 (0)