From 5028ef9e0e4a3f505da19c005800f273af671534 Mon Sep 17 00:00:00 2001 From: Ivan Chernetsky Date: Sun, 2 Nov 2014 03:16:59 -0800 Subject: Allow to specify a path to vm.args through command-line arguments --- README.md | 1 + src/relx.erl | 1 + src/rlx_cmd_args.erl | 3 +++ src/rlx_config.erl | 7 ++++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c68dfb..9e7217c 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Options | -a | --override_app | string | | An app name and a directory to override in the form appname:dir | | -c | --config | string | ./relx.config | Config file path | | | --overlay_vars | string | | Path to a file of overlay variables | +| | --vm_args | string | | Path to a file to use for vm.args | | | --sys_config | string | | Path to a file to use for sys.config | | -d | --dev-mode | boolean | false | Symlink all applications and configuration into the release instead of copying| | -i | --include-erts | boolean/string | true | If true include a copy of erts used to build with, if a path include erts at that path. If false, do not include erts | diff --git a/src/relx.erl b/src/relx.erl index 37918be..433e0a5 100644 --- a/src/relx.erl +++ b/src/relx.erl @@ -210,6 +210,7 @@ opt_spec_list() -> "Provide an app name and a directory to override in the form :"}, {config, $c, "config", {string, ""}, "The path to a config file"}, {overlay_vars, undefined, "overlay_vars", string, "Path to a file of overlay variables"}, + {vm_args, undefined, "vm_args", string, "Path to a file to use for vm.args"}, {sys_config, undefined, "sys_config", string, "Path to a file to use for sys.config"}, {system_libs, undefined, "system_libs", string, "Path to dir of Erlang system libs"}, {version, undefined, "version", undefined, "Print relx version"}, diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl index ac3e718..44fd226 100644 --- a/src/rlx_cmd_args.erl +++ b/src/rlx_cmd_args.erl @@ -240,6 +240,9 @@ create(overlay_vars, Opts)-> create(sys_config, Opts) -> SysConfig = proplists:get_value(sys_config, Opts, undefined), {sys_config, SysConfig}; +create(vm_args, Opts) -> + VmArgs = proplists:get_value(vm_args, Opts, undefined), + {vm_args, VmArgs}; create(system_libs, Opts) -> SystemLibs = proplists:get_value(system_libs, Opts, undefined), {system_libs, SystemLibs}; diff --git a/src/rlx_config.erl b/src/rlx_config.erl index dbfe1c6..07ac2c5 100644 --- a/src/rlx_config.erl +++ b/src/rlx_config.erl @@ -205,7 +205,12 @@ load_terms({release, {RelName, Vsn}, {erts, ErtsVsn}, {ok, rlx_state:add_configured_release(State, Release1)} end; load_terms({vm_args, VmArgs}, {ok, State}) -> - {ok, rlx_state:vm_args(State, filename:absname(VmArgs))}; + case rlx_state:vm_args(State) of + undefined -> + {ok, rlx_state:vm_args(State, filename:absname(VmArgs))}; + _ -> + {ok, State} + end; load_terms({sys_config, SysConfig}, {ok, State}) -> case rlx_state:sys_config(State) of undefined -> -- cgit v1.2.3