Mercurial > prosody-hg
changeset 14038:1a2691bd50bd 13.0
modulemanager: Allow component modules to specify additional inherited modules
If a component module knows some extra modules which are traditionally loaded
globally that might apply to it, it can declare them:
--% inherit_modules: server_contact_info
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 12 Jan 2026 17:17:51 +0000 |
| parents | cc916272c30f |
| children | 4421dcb755b5 |
| files | core/modulemanager.lua |
| diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/core/modulemanager.lua Mon Jan 12 17:13:06 2026 +0000 +++ b/core/modulemanager.lua Mon Jan 12 17:17:51 2026 +0000 @@ -37,7 +37,7 @@ "s2s", "s2s_auth_certs", }; -local component_inheritable_modules = { +local default_component_inheritable_modules = { "tls", "saslauth", "dialback", @@ -128,7 +128,17 @@ local global_modules = set.new(autoload_modules) + set.new(global_modules_enabled) - set.new(global_modules_disabled); if component then - global_modules = set.intersection(set.new(component_inheritable_modules), global_modules); + local component_inheritable_modules = set.new(default_component_inheritable_modules); + local ok, _, metadata = loader:load_resource(component); + if ok then + local extra_inheritable_modules = metadata.inherit_modules; + if extra_inheritable_modules then + for inherit_module in extra_inheritable_modules:gmatch("[^, ]+") do + component_inheritable_modules:add(inherit_module); + end + end + end + global_modules = set.intersection(component_inheritable_modules, global_modules); end local modules = (global_modules + set.new(host_modules_enabled)) - set.new(host_modules_disabled);
