aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2015-09-22 12:49:55 +0200
committerChristophe Romain <christophe.romain@process-one.net>2015-09-22 12:49:55 +0200
commit23a1aceac0e2654980029f4e5138768495b33dca (patch)
tree3ba2f54c851ee18d4e3bdf3e7919aee8ccfbb6d2 /src
parentAdd MAM (XEP-0313) v0.4 support (diff)
Improve external module configuration management (EJAB-1746)
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_config.erl7
-rw-r--r--src/ext_mod.erl6
2 files changed, 10 insertions, 3 deletions
diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl
index 253e7ab11..c33555913 100644
--- a/src/ejabberd_config.erl
+++ b/src/ejabberd_config.erl
@@ -201,9 +201,12 @@ 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,
BinTerms = BinTerms1 ++ [{include_config_file, list_to_binary(V)} || V <- ModInc],
BinTerms2 = case proplists:get_bool(replace_macros, Opts) of
diff --git a/src/ext_mod.erl b/src/ext_mod.erl
index 4b9ddafab..765d38b4f 100644
--- a/src/ext_mod.erl
+++ b/src/ext_mod.erl
@@ -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).