mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Improve external module configuration management (EJAB-1746)
This commit is contained in:
parent
70b1dc479c
commit
23a1aceac0
@ -201,9 +201,12 @@ get_plain_terms_file(File1, Opts) ->
|
|||||||
BinTerms1 = strings_to_binary(Terms),
|
BinTerms1 = strings_to_binary(Terms),
|
||||||
ModInc = case proplists:get_bool(include_modules_configs, Opts) of
|
ModInc = case proplists:get_bool(include_modules_configs, Opts) of
|
||||||
true ->
|
true ->
|
||||||
filelib:wildcard(ext_mod:modules_dir() ++ "/*/conf/*.{yml,yaml}");
|
Files = [{filename:rootname(filename:basename(F)), F}
|
||||||
|
|| F <- filelib:wildcard(ext_mod:config_dir() ++ "/*.{yml,yaml}")
|
||||||
|
++ filelib:wildcard(ext_mod:modules_dir() ++ "/*/conf/*.{yml,yaml}")],
|
||||||
|
[proplists:get_value(F,Files) || F <- proplists:get_keys(Files)];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
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
|
BinTerms2 = case proplists:get_bool(replace_macros, Opts) of
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
installed_command/0, installed/0, installed/1,
|
installed_command/0, installed/0, installed/1,
|
||||||
install/1, uninstall/1, upgrade/0, upgrade/1,
|
install/1, uninstall/1, upgrade/0, upgrade/1,
|
||||||
add_sources/2, del_sources/1, modules_dir/0,
|
add_sources/2, del_sources/1, modules_dir/0,
|
||||||
opt_type/1]).
|
config_dir/0, opt_type/1]).
|
||||||
|
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
|
|
||||||
@ -350,6 +350,10 @@ modules_dir() ->
|
|||||||
sources_dir() ->
|
sources_dir() ->
|
||||||
filename:join(modules_dir(), "sources").
|
filename:join(modules_dir(), "sources").
|
||||||
|
|
||||||
|
config_dir() ->
|
||||||
|
DefaultDir = filename:join(modules_dir(), "conf"),
|
||||||
|
getenv("CONTRIB_MODULES_CONF_DIR", DefaultDir).
|
||||||
|
|
||||||
module_lib_dir(Package) ->
|
module_lib_dir(Package) ->
|
||||||
filename:join(modules_dir(), Package).
|
filename:join(modules_dir(), Package).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user