diff util/prosodyctl/check.lua @ 14043:d8a30fdfbddd 13.0

util.prosodyctl.check: Fix #1978 Fixes an error that occurs when modules_enabled is not present in the global section nor in a Component section, leading to an attempt to index nil.
author Kim Alvefur <zash@zash.se>
date Tue, 13 Jan 2026 22:55:14 +0100
parents 2afb278326ce
children f5d415d54064 48ea7a15957e
line wrap: on
line diff
--- a/util/prosodyctl/check.lua	Mon Jan 12 18:02:51 2026 +0000
+++ b/util/prosodyctl/check.lua	Tue Jan 13 22:55:14 2026 +0100
@@ -475,7 +475,6 @@
 			"websocket_get_response_text",
 		});
 		local config = configmanager.getconfig();
-		local global = api("*");
 		-- Check that we have any global options (caused by putting a host at the top)
 		if it.count(it.filter("log", pairs(config["*"]))) == 0 then
 			ok = false;
@@ -538,9 +537,8 @@
 		end
 
 		do -- Check for modules enabled both normally and as components
-			local modules = global:get_option_set("modules_enabled");
-			for host, options in enabled_hosts() do
-				local component_module = options.component_module;
+			for host in enabled_hosts() do
+				local modules, component_module = modulemanager.get_modules_for_host(host);
 				if component_module and modules:contains(component_module) then
 					print(("    mod_%s is enabled both in modules_enabled and as Component %q %q"):format(component_module, host, component_module));
 					print("    This means the service is enabled on all VirtualHosts as well as the Component.");