Software /
code /
prosody
Changeset
8916:e727747279a0
modulemanager: Expose function to get the list of modules that should be loaded on a host
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 20 Jun 2018 10:41:02 +0100 |
parents | 8915:2502be210a85 |
children | 8917:d4c98115e00c |
files | core/modulemanager.lua |
diffstat | 1 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/core/modulemanager.lua Mon Jun 18 04:25:01 2018 +0200 +++ b/core/modulemanager.lua Wed Jun 20 10:41:02 2018 +0100 @@ -46,8 +46,8 @@ -- [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 @@ 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 @@ end return { + get_modules_for_host = get_modules_for_host; load_modules_for_host = load_modules_for_host; load = load; unload = unload;