25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Properly handle define_macros in merged config files

This commit is contained in:
Paweł Chmielowski 2015-09-16 12:19:54 +02:00
parent a8d6439a4b
commit 5593ebbbca

View File

@ -120,12 +120,7 @@ read_file(File) ->
{include_modules_configs, true}]).
read_file(File, Opts) ->
Terms1 = get_plain_terms_file(File, Opts),
Terms_macros = case proplists:get_bool(replace_macros, Opts) of
true -> replace_macros(Terms1);
false -> Terms1
end,
Terms = transform_terms(Terms_macros),
Terms = get_plain_terms_file(File, Opts),
State = lists:foldl(fun search_hosts/2, #state{}, Terms),
{Head, Tail} = lists:partition(
fun({host_config, _}) -> false;
@ -211,11 +206,16 @@ get_plain_terms_file(File1, Opts) ->
[]
end,
BinTerms = BinTerms1 ++ [{include_config_file, list_to_binary(V)} || V <- ModInc],
BinTerms2 = case proplists:get_bool(replace_macros, Opts) of
true -> replace_macros(BinTerms);
false -> BinTerms
end,
BinTerms3 = transform_terms(BinTerms2),
case proplists:get_bool(include_files, Opts) of
true ->
include_config_files(BinTerms);
include_config_files(BinTerms3);
false ->
BinTerms
BinTerms3
end;
{error, Reason} ->
?ERROR_MSG(Reason, []),