util/prosodyctl/check.lua
changeset 12162 7ff3699c1653
parent 12161 1dd9ee6112e9
child 12163 aa299551f8c6
equal deleted inserted replaced
12161:1dd9ee6112e9 12162:7ff3699c1653
   111 			"s2s_dns_resolvers",
   111 			"s2s_dns_resolvers",
   112 			"setgid",
   112 			"setgid",
   113 			"setuid",
   113 			"setuid",
   114 		});
   114 		});
   115 		local deprecated_replacements = {
   115 		local deprecated_replacements = {
   116 			anonymous_login = "use 'authentication = \"anonymous\"'",
   116 			anonymous_login = "instead, use 'authentication = \"anonymous\"'",
   117 			daemonize = "use the --daemonize/-D or --foreground/-F command line flags",
   117 			daemonize = "instead, use the --daemonize/-D or --foreground/-F command line flags",
   118 			disallow_s2s = "add \"s2s\" to 'modules_disabled'",
   118 			disallow_s2s = "instead, add \"s2s\" to 'modules_disabled'",
   119 			no_daemonize = "use the --daemonize/-D or --foreground/-F command line flags",
   119 			no_daemonize = "instead, use the --daemonize/-D or --foreground/-F command line flags",
   120 			require_encryption = "use 'c2s_require_encryption' and 's2s_require_encryption'",
   120 			require_encryption = "instead, use 'c2s_require_encryption' and 's2s_require_encryption'",
   121 			vcard_compatibility = "use 'mod_compat_vcard' from prosody-modules",
   121 			vcard_compatibility = "instead, use 'mod_compat_vcard' from prosody-modules",
   122 			use_libevent = "use 'network_backend = \"event\"'",
   122 			use_libevent = "instead, use 'network_backend = \"event\"'",
   123 			whitelist_registration_only = "use 'allowlist_registration_only'",
   123 			whitelist_registration_only = "instead, use 'allowlist_registration_only'",
   124 			registration_whitelist = "use 'registration_allowlist'",
   124 			registration_whitelist = "instead, use 'registration_allowlist'",
   125 			registration_blacklist = "use 'registration_blocklist'",
   125 			registration_blacklist = "instead, use 'registration_blocklist'",
   126 			blacklist_on_registration_throttle_overload = "use 'blocklist_on_registration_throttle_overload'",
   126 			blacklist_on_registration_throttle_overload = "instead, use 'blocklist_on_registration_throttle_overload'",
   127 		};
   127 		};
   128 		-- FIXME all the singular _port and _interface options are supposed to be deprecated too
   128 		-- FIXME all the singular _port and _interface options are supposed to be deprecated too
   129 		local deprecated_ports = { bosh = "http", legacy_ssl = "c2s_direct_tls" };
   129 		local deprecated_ports = { bosh = "http", legacy_ssl = "c2s_direct_tls" };
   130 		local port_suffixes = set.new({ "port", "ports", "interface", "interfaces", "ssl" });
   130 		local port_suffixes = set.new({ "port", "ports", "interface", "interfaces", "ssl" });
   131 		for port, replacement in pairs(deprecated_ports) do
   131 		for port, replacement in pairs(deprecated_ports) do
   132 			for suffix in port_suffixes do
   132 			for suffix in port_suffixes do
   133 				local rsuffix = (suffix == "port" or suffix == "interface") and suffix.."s" or suffix;
   133 				local rsuffix = (suffix == "port" or suffix == "interface") and suffix.."s" or suffix;
   134 				deprecated_replacements[port.."_"..suffix] = "use '"..replacement.."_"..rsuffix.."'"
   134 				deprecated_replacements[port.."_"..suffix] = "instead, use '"..replacement.."_"..rsuffix.."'"
   135 			end
   135 			end
   136 		end
   136 		end
   137 		local deprecated = set.new(array.collect(it.keys(deprecated_replacements)));
   137 		local deprecated = set.new(array.collect(it.keys(deprecated_replacements)));
   138 		local known_global_options = set.new({
   138 		local known_global_options = set.new({
   139 			"access_control_allow_credentials",
   139 			"access_control_allow_credentials",
   263 		local deprecated_global_options = set.intersection(global_options, deprecated);
   263 		local deprecated_global_options = set.intersection(global_options, deprecated);
   264 		if not deprecated_global_options:empty() then
   264 		if not deprecated_global_options:empty() then
   265 			print("");
   265 			print("");
   266 			print("    You have some deprecated options in the global section:");
   266 			print("    You have some deprecated options in the global section:");
   267 			for option in deprecated_global_options do
   267 			for option in deprecated_global_options do
   268 				print(("    '%s' -- instead, %s"):format(option, deprecated_replacements[option]));
   268 				print(("    '%s' -- %s"):format(option, deprecated_replacements[option]));
   269 			end
   269 			end
   270 			ok = false;
   270 			ok = false;
   271 		end
   271 		end
   272 		for host, options in it.filter(function (h) return h ~= "*" end, pairs(configmanager.getconfig())) do
   272 		for host, options in it.filter(function (h) return h ~= "*" end, pairs(configmanager.getconfig())) do
   273 			local host_options = set.new(it.to_array(it.keys(options)));
   273 			local host_options = set.new(it.to_array(it.keys(options)));