diff options
author | Kim Alvefur <zash@zash.se> | 2025-02-22 00:08:18 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2025-02-22 00:08:18 +0100 |
commit | 5e41daac799c7195fd5885da254cbba13025cca6 (patch) | |
tree | 452ebc0137ca97f54a1b157051d1d965911d9936 /core | |
parent | 9eedb15c6fc760e45316a02cf372b00bb6547f09 (diff) | |
download | prosody-5e41daac799c7195fd5885da254cbba13025cca6.tar.gz prosody-5e41daac799c7195fd5885da254cbba13025cca6.zip |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/configmanager.lua | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua index effe33a1..526409e8 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -34,7 +34,6 @@ local parser = nil; 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 @@ function _M.getconfig() 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 @@ do 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 @@ do :format(config_file, get_line_number(config_file)); }); end - end local chunk, err = envload(data, "@"..config_file, env); |