# HG changeset patch # User Kim Alvefur # Date 1740179298 -3600 # Node ID 34ac05f6bd1011bba3dffcb1fa2728606b455e71 # Parent 0c7e11c11968ad8389d76399ebb61ac9db5ec11e core.configmanager: Fix reporting delayed warnings from global section A Credential in the global section would be stored at delayed_warnings["*/secret"], but get("example.com","secret") would look for delayed_warnings["example.com/secret"] Storing the warnings in the config itself has the unfortunate side-effect that the config now contains util.error objects, which may be awkward if something bypasses get(). Should rawget() also do this filtering? getconfig() too? Currently this only affects prosodyctl, so maybe it won't be much of a problem. diff -r 0c7e11c11968 -r 34ac05f6bd10 core/configmanager.lua --- a/core/configmanager.lua Sat Feb 22 00:00:41 2025 +0100 +++ b/core/configmanager.lua Sat Feb 22 00:08:18 2025 +0100 @@ -34,7 +34,6 @@ local config_mt = { __index = function (t, _) return rawget(t, "*"); end}; local config = setmetatable({ ["*"] = { } }, config_mt); -local delayed_warnings = {}; local files = {}; local credentials_directory = nil; local credential_fallback_fatal = true; @@ -47,11 +46,12 @@ end function _M.get(host, key) - if host and key and delayed_warnings[host.."/"..key] then - local warning = delayed_warnings[host.."/"..key]; - log("warn", "%s", warning.text); + local v = config[host][key]; + if v and errors.is_error(v) then + log("warn", "%s", v.text); + return nil; end - return config[host][key]; + return v; end function _M.rawget(host, key) local hostconfig = rawget(config, host); @@ -252,10 +252,6 @@ t_insert(warnings, ("%s:%d: Duplicate option '%s'"):format(config_file, get_line_number(config_file), k)); end set_options[option_path] = true; - if errors.is_error(v) then - delayed_warnings[option_path] = v; - return; - end set(config_table, env.__currenthost or "*", k, v); end }); @@ -385,7 +381,6 @@ :format(config_file, get_line_number(config_file)); }); end - end local chunk, err = envload(data, "@"..config_file, env);