prosodyctl: Config check for modules that are also components (fixes #1138)
authorKim Alvefur <zash@zash.se>
Fri, 11 May 2018 16:03:35 +0200
changeset 8790 5dbebb7627ef
parent 8789 adffadd88ff0
child 8791 7a9b680a79fb
prosodyctl: Config check for modules that are also components (fixes #1138)
prosodyctl
--- a/prosodyctl	Sat Apr 28 00:47:08 2018 +0200
+++ b/prosodyctl	Fri May 11 16:03:35 2018 +0200
@@ -838,6 +838,19 @@
 			end
 			print();
 		end
+
+		do -- Check for modules enabled both normally and as components
+			local modules = set.new(config["*"]["modules_enabled"]);
+			for host, options in enabled_hosts() do
+				local component_module = options.component_module;
+				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.");
+					print("    Are you sure this what you want? It may cause unexpected behaviour.");
+				end
+			end
+		end
+
 		-- Check for global options under hosts
 		local global_options = set.new(it.to_array(it.keys(config["*"])));
 		local deprecated_global_options = set.intersection(global_options, deprecated);