aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-06-20 10:41:02 +0100
committerMatthew Wild <mwild1@gmail.com>2018-06-20 10:41:02 +0100
commit06a10d3a77d031a12881a98319d963e127240166 (patch)
treeab5d0f1762efe663b108f2d468534d625bc103cd /core
parent86866da884f2749767404ad5fe025b54d7991b48 (diff)
downloadprosody-06a10d3a77d031a12881a98319d963e127240166.tar.gz
prosody-06a10d3a77d031a12881a98319d963e127240166.zip
modulemanager: Expose function to get the list of modules that should be loaded on a host
Diffstat (limited to 'core')
-rw-r--r--core/modulemanager.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 60af8d79..81c28aa0 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -46,8 +46,8 @@ local get_modules, is_loaded, module_has_method, call_module_method;
-- [host] = { [module] = module_env }
local modulemap = { ["*"] = {} };
--- Load modules when a host is activated
-function load_modules_for_host(host)
+-- Get the list of modules to be loaded on a host
+local function get_modules_for_host(host)
local component = config.get(host, "component_module");
local global_modules_enabled = config.get("*", "modules_enabled");
@@ -71,8 +71,16 @@ function load_modules_for_host(host)
modules:add("admin_telnet");
end
- if component then
- load(host, component);
+ return modules, component;
+end
+
+-- Load modules when a host is activated
+function load_modules_for_host(host)
+ local modules, component_module = get_modules_for_host(host);
+
+ -- Ensure component module is loaded first
+ if component_module then
+ load(host, component_module);
end
for module in modules do
load(host, module);
@@ -324,6 +332,7 @@ function call_module_method(module, method, ...)
end
return {
+ get_modules_for_host = get_modules_for_host;
load_modules_for_host = load_modules_for_host;
load = load;
unload = unload;