Changeset

13830:145b71d1283c 13.0

prosodyctl check config: List modules which Prosody cannot successfully load
author Matthew Wild <mwild1@gmail.com>
date Wed, 09 Apr 2025 10:54:01 +0100 (6 weeks ago)
parents 13829:dde0ce03049b
children 13831:bf4cd327966f 13832:5973a5d22ab5
files util/prosodyctl/check.lua
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/prosodyctl/check.lua	Wed Apr 09 10:53:37 2025 +0100
+++ b/util/prosodyctl/check.lua	Wed Apr 09 10:54:01 2025 +0100
@@ -644,6 +644,25 @@
 			print("    been deprecated. You can safely remove it.");
 		end
 
+		local load_failures = {};
+		for mod_name in all_modules do
+			local mod, err = modulemanager.loader:load_resource(mod_name, nil);
+			if not mod then
+				load_failures[mod_name] = err;
+			end
+		end
+
+		if next(load_failures) ~= nil then
+			print("");
+			print("    The following modules failed to load:");
+			print("");
+			for mod_name, err in it.sorted_pairs(load_failures) do
+				print(("        mod_%s: %s"):format(mod_name, err));
+			end
+			print("")
+			print("    Check for typos and remove any obsolete/incompatible modules from your config.");
+		end
+
 		for host, host_config in pairs(config) do --luacheck: ignore 213/host
 			if type(rawget(host_config, "storage")) == "string" and rawget(host_config, "default_storage") then
 				print("");