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:
parent
a8d6439a4b
commit
5593ebbbca
@ -120,12 +120,7 @@ read_file(File) ->
|
|||||||
{include_modules_configs, true}]).
|
{include_modules_configs, true}]).
|
||||||
|
|
||||||
read_file(File, Opts) ->
|
read_file(File, Opts) ->
|
||||||
Terms1 = get_plain_terms_file(File, Opts),
|
Terms = 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),
|
|
||||||
State = lists:foldl(fun search_hosts/2, #state{}, Terms),
|
State = lists:foldl(fun search_hosts/2, #state{}, Terms),
|
||||||
{Head, Tail} = lists:partition(
|
{Head, Tail} = lists:partition(
|
||||||
fun({host_config, _}) -> false;
|
fun({host_config, _}) -> false;
|
||||||
@ -211,11 +206,16 @@ get_plain_terms_file(File1, Opts) ->
|
|||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
BinTerms = BinTerms1 ++ [{include_config_file, list_to_binary(V)} || V <- ModInc],
|
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
|
case proplists:get_bool(include_files, Opts) of
|
||||||
true ->
|
true ->
|
||||||
include_config_files(BinTerms);
|
include_config_files(BinTerms3);
|
||||||
false ->
|
false ->
|
||||||
BinTerms
|
BinTerms3
|
||||||
end;
|
end;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?ERROR_MSG(Reason, []),
|
?ERROR_MSG(Reason, []),
|
||||||
|
Loading…
Reference in New Issue
Block a user