Software /
code /
prosody
Diff
core/modulemanager.lua @ 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 |
parent | 8717:9ddd0fbbe53a |
child | 9562:acf74ad0b795 |
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;