Comparison

util/prosodyctl/check.lua @ 12159:aa299551f8c6

util.prosodyctl.check: Parameterize replacement instructions This ought to make it easier to translate in the future. And easier to reword, now!
author Kim Alvefur <zash@zash.se>
date Sat, 08 Jan 2022 18:02:32 +0100
parent 12158:7ff3699c1653
child 12217:39043233de04
comparison
equal deleted inserted replaced
12158:7ff3699c1653 12159:aa299551f8c6
110 "muc_log_cleanup_interval", 110 "muc_log_cleanup_interval",
111 "s2s_dns_resolvers", 111 "s2s_dns_resolvers",
112 "setgid", 112 "setgid",
113 "setuid", 113 "setuid",
114 }); 114 });
115 local function instead_use(kind, name, value)
116 if kind == "option" then
117 if value then
118 return string.format("instead, use '%s = %q'", name, value);
119 else
120 return string.format("instead, use '%s'", name);
121 end
122 elseif kind == "module" then
123 return string.format("instead, add %q to '%s'", name, value or "modules_enabled");
124 elseif kind == "community" then
125 return string.format("instead, add %q from %s", name, value or "prosody-modules");
126 end
127 return kind
128 end
115 local deprecated_replacements = { 129 local deprecated_replacements = {
116 anonymous_login = "instead, use 'authentication = \"anonymous\"'", 130 anonymous_login = instead_use("option", "authentication", "anonymous");
117 daemonize = "instead, use the --daemonize/-D or --foreground/-F command line flags", 131 daemonize = "instead, use the --daemonize/-D or --foreground/-F command line flags";
118 disallow_s2s = "instead, add \"s2s\" to 'modules_disabled'", 132 disallow_s2s = instead_use("module", "s2s");
119 no_daemonize = "instead, use the --daemonize/-D or --foreground/-F command line flags", 133 no_daemonize = "instead, use the --daemonize/-D or --foreground/-F command line flags";
120 require_encryption = "instead, use 'c2s_require_encryption' and 's2s_require_encryption'", 134 require_encryption = "instead, use 'c2s_require_encryption' and 's2s_require_encryption'";
121 vcard_compatibility = "instead, use 'mod_compat_vcard' from prosody-modules", 135 vcard_compatibility = instead_use("community", "mod_compat_vcard");
122 use_libevent = "instead, use 'network_backend = \"event\"'", 136 use_libevent = instead_use("option", "network_backend", "event");
123 whitelist_registration_only = "instead, use 'allowlist_registration_only'", 137 whitelist_registration_only = instead_use("option", "allowlist_registration_only");
124 registration_whitelist = "instead, use 'registration_allowlist'", 138 registration_whitelist = instead_use("option", "registration_allowlist");
125 registration_blacklist = "instead, use 'registration_blocklist'", 139 registration_blacklist = instead_use("option", "registration_blocklist");
126 blacklist_on_registration_throttle_overload = "instead, use 'blocklist_on_registration_throttle_overload'", 140 blacklist_on_registration_throttle_overload = instead_use("blocklist_on_registration_throttle_overload");
127 }; 141 };
128 -- FIXME all the singular _port and _interface options are supposed to be deprecated too 142 -- 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" }; 143 local deprecated_ports = { bosh = "http", legacy_ssl = "c2s_direct_tls" };
130 local port_suffixes = set.new({ "port", "ports", "interface", "interfaces", "ssl" }); 144 local port_suffixes = set.new({ "port", "ports", "interface", "interfaces", "ssl" });
131 for port, replacement in pairs(deprecated_ports) do 145 for port, replacement in pairs(deprecated_ports) do