Include odbc app in release only when required (#3633)

This commit is contained in:
Badlop 2021-06-27 17:08:21 +02:00
parent b5b2ad560a
commit 774de2bdc5
2 changed files with 13 additions and 2 deletions

View File

@ -173,7 +173,7 @@
{"stringprep", []}]}.
{relx, [{release, {ejabberd, {cmd, "grep {vsn, vars.config | sed 's|{vsn, \"||;s|\"}.||' | tr -d '\012'"}},
[ejabberd, odbc]},
[ejabberd]},
{sys_config, "./rel/sys.config"},
{vm_args, "./rel/vm.args"},
{overlay_vars, "vars.config"},

View File

@ -339,6 +339,17 @@ fun(Deps, FDeps) ->
end, Deps)
end,
VarsApps = case file:consult(filename:join([filename:dirname(SCRIPT),"vars.config"])) of
{ok, TermsV} ->
case proplists:get_bool(odbc, TermsV) of
true -> [odbc];
false -> []
end;
_->
[]
end,
ProcessRelx = fun(Relx, Deps) ->
{value, {release, NameVersion, DefaultApps}, RelxTail} = lists:keytake(release, 1, Relx),
ProfileApps = case os:getenv("REBAR_PROFILE") of
@ -348,7 +359,7 @@ ProcessRelx = fun(Relx, Deps) ->
DepApps = lists:map(fun({DepName, _, _}) -> DepName;
({DepName, _}) -> DepName
end, Deps),
[{release, NameVersion, DefaultApps ++ ProfileApps ++ DepApps} | RelxTail]
[{release, NameVersion, DefaultApps ++ VarsApps ++ ProfileApps ++ DepApps} | RelxTail]
end,
GithubConfig = case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of