25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Improve external module configuration management (EJAB-1746)

This commit is contained in:
Christophe Romain 2015-09-22 12:49:55 +02:00
parent 70b1dc479c
commit 23a1aceac0
2 changed files with 10 additions and 3 deletions

View File

@ -201,7 +201,10 @@ get_plain_terms_file(File1, Opts) ->
BinTerms1 = strings_to_binary(Terms),
ModInc = case proplists:get_bool(include_modules_configs, Opts) of
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,

View File

@ -33,7 +33,7 @@
installed_command/0, installed/0, installed/1,
install/1, uninstall/1, upgrade/0, upgrade/1,
add_sources/2, del_sources/1, modules_dir/0,
opt_type/1]).
config_dir/0, opt_type/1]).
-include("ejabberd_commands.hrl").
@ -350,6 +350,10 @@ modules_dir() ->
sources_dir() ->
filename:join(modules_dir(), "sources").
config_dir() ->
DefaultDir = filename:join(modules_dir(), "conf"),
getenv("CONTRIB_MODULES_CONF_DIR", DefaultDir).
module_lib_dir(Package) ->
filename:join(modules_dir(), Package).