diff options
author | Matthew Wild <mwild1@gmail.com> | 2025-03-17 16:49:22 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2025-03-17 16:49:22 +0000 |
commit | 8a4d96bb71ea4a3d9e46d9ffd034d5e25d7602e5 (patch) | |
tree | 7718180cdc2f0a48ecfc3c8d501b6e3688b07bb7 /util/prosodyctl | |
parent | 8bcd4f68070ebce01171416059d60ab2545ce066 (diff) | |
parent | 3d74ce85841c461d67c54f4dcc8cac6db87ff623 (diff) | |
download | prosody-master.tar.gz prosody-master.zip |
Merge 13.0->trunkHEADorigin/mastermaster
Diffstat (limited to 'util/prosodyctl')
-rw-r--r-- | util/prosodyctl/check.lua | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua index 0a0ab878..75ff5da4 100644 --- a/util/prosodyctl/check.lua +++ b/util/prosodyctl/check.lua @@ -651,6 +651,15 @@ local function check(arg) break; end 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(""); + print(" The 'default_storage' option is not needed if 'storage' is set to a string."); + break; + end + end + local require_encryption = set.intersection(all_options, set.new({ "require_encryption", "c2s_require_encryption", "s2s_require_encryption" })):empty(); @@ -725,12 +734,17 @@ local function check(arg) local orphan_components = {}; local referenced_components = set.new(); local enabled_hosts_set = set.new(); + local invalid_disco_items = {}; for host in it.filter("*", pairs(configmanager.getconfig())) do local hostapi = api(host); if hostapi:get_option_boolean("enabled", true) then enabled_hosts_set:add(host); for _, disco_item in ipairs(hostapi:get_option_array("disco_items", {})) do - referenced_components:add(disco_item[1]); + if type(disco_item[1]) == "string" then + referenced_components:add(disco_item[1]); + else + invalid_disco_items[host] = true; + end end end end @@ -744,6 +758,18 @@ local function check(arg) end end end + + if next(invalid_disco_items) ~= nil then + print(""); + print(" Some hosts in your configuration file have an invalid 'disco_items' option."); + print(" This may cause further errors, such as unreferenced components."); + print(""); + for host in it.sorted_pairs(invalid_disco_items) do + print(" - "..host); + end + print(""); + end + if #orphan_components > 0 then table.sort(orphan_components); print(""); @@ -1600,9 +1626,11 @@ local function check(arg) -- And components linked explicitly for _, disco_item in ipairs(hostapi:get_option_array("disco_items", {})) do local other_host = disco_item[1]; - local component_module = configmanager.get(other_host, "component_module"); - if component_module then - table.insert(host_components[component_module], other_host); + if type(other_host) == "string" then + local component_module = configmanager.get(other_host, "component_module"); + if component_module then + table.insert(host_components[component_module], other_host); + end end end end |