aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/relx.erl1
-rw-r--r--src/rlx_cmd_args.erl8
-rw-r--r--src/rlx_prv_config.erl4
-rw-r--r--src/rlx_state.erl10
4 files changed, 19 insertions, 4 deletions
diff --git a/src/relx.erl b/src/relx.erl
index dc5b8e0..7b09751 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -200,6 +200,7 @@ opt_spec_list() ->
{override_app, $a, "override_app", string,
"Provide an app name and a directory to override in the form <appname>:<app directory>"},
{config, $c, "config", {string, ""}, "The path to a config file"},
+ {overlay_vars, undefined, "overlay_vars", string, "Path to a file of overlay variables"},
{version, $v, "version", undefined, "Print relx version"},
{root_dir, $r, "root", string, "The project root directory"}].
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl
index 2a0f573..e360ab8 100644
--- a/src/rlx_cmd_args.erl
+++ b/src/rlx_cmd_args.erl
@@ -246,7 +246,13 @@ create_root_dir(Opts, Acc) ->
{ok, rlx_state:cmd_args()} | relx:error().
create_disable_default_libs(Opts, Acc) ->
Def = proplists:get_value(default_libs, Opts, true),
- create_upfrom(Opts, [{default_libs, Def} | Acc]).
+ create_overlay_vars(Opts, [{default_libs, Def} | Acc]).
+
+-spec create_overlay_vars([getopt:option()], rlx_state:cmd_args()) ->
+ {ok, rlx_state:cmd_args()} | relx:error().
+create_overlay_vars(Opts, Acc) ->
+ OverlayVars = proplists:get_all_values(overlay_vars, Opts),
+ create_upfrom(Opts, [{overlay_vars, OverlayVars} | Acc]).
-spec create_upfrom([getopt:option()], rlx_state:cmd_args()) ->
{ok, rlx_state:cmd_args()} | relx:error().
diff --git a/src/rlx_prv_config.erl b/src/rlx_prv_config.erl
index dd11e65..71a2dc9 100644
--- a/src/rlx_prv_config.erl
+++ b/src/rlx_prv_config.erl
@@ -174,6 +174,10 @@ load_terms({vm_args, VmArgs}, {ok, State}) ->
{ok, rlx_state:vm_args(State, filename:absname(VmArgs))};
load_terms({sys_config, SysConfig}, {ok, State}) ->
{ok, rlx_state:sys_config(State, filename:absname(SysConfig))};
+load_terms({overlay_vars, OverlayVars}, {ok, State}) ->
+ CurrentOverlayVars = rlx_state:get(State, overlay_vars),
+ NewOverlayVars = lists:umerge(lists:usort(OverlayVars), lists:usort(CurrentOverlayVars)),
+ {ok, rlx_state:put(State, overlay_vars, NewOverlayVars)};
load_terms({Name, Value}, {ok, State})
when erlang:is_atom(Name) ->
{ok, rlx_state:put(State, Name, Value)};
diff --git a/src/rlx_state.erl b/src/rlx_state.erl
index 4c6df07..74304cc 100644
--- a/src/rlx_state.erl
+++ b/src/rlx_state.erl
@@ -134,9 +134,13 @@ new(PropList, Targets)
upfrom = proplists:get_value(upfrom, PropList, undefined),
default_configured_release={proplists:get_value(relname, PropList, undefined),
proplists:get_value(relvsn, PropList, undefined)}},
- rlx_state:put(create_logic_providers(State0),
- default_libs,
- proplists:get_value(default_libs, PropList, true)).
+ State1 = rlx_state:put(create_logic_providers(State0),
+ default_libs,
+ proplists:get_value(default_libs, PropList, true)),
+
+ rlx_state:put(create_logic_providers(State1),
+ overlay_vars,
+ proplists:get_value(overlay_vars, PropList, [])).
%% @doc the actions targeted for this system
-spec actions(t()) -> [action()].