Mercurial > prosody-hg
changeset 14207:23f1c71b3d56 13.0
net.unbound: Reset and apply new config on reload
Makes new configuration apply, which is otherwise somewhat tricky to do.
Also merges identical conditions into one block.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 30 May 2026 00:32:06 +0200 |
| parents | a874c3f4570a |
| children | 9c062f243d3a |
| files | net/unbound.lua |
| diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/net/unbound.lua Thu May 28 17:25:46 2026 +0100 +++ b/net/unbound.lua Sat May 30 00:32:06 2026 +0200 @@ -42,13 +42,6 @@ end local unbound_config; -if prosody then - local config = require"prosody.core.configmanager"; - unbound_config = add_defaults(config.get("*", "unbound")); - prosody.events.add_handler("config-reloaded", function() - unbound_config = add_defaults(config.get("*", "unbound")); - end); -end -- Note: libunbound will default to using root hints if resolvconf is unset local function connect_server(unbound, server) @@ -65,9 +58,6 @@ unbound = libunbound.new(unbound_config); server_conn = connect_server(unbound, net_server); end -if prosody then - prosody.events.add_handler("server-started", initialize); -end local answer_mt = { __tostring = function(self) @@ -181,6 +171,16 @@ return true; end +if prosody then + local config = require"prosody.core.configmanager"; + unbound_config = add_defaults(config.get("*", "unbound")); + prosody.events.add_handler("config-reloaded", function() + unbound_config = add_defaults(config.get("*", "unbound")); + purge(); + end); + prosody.events.add_handler("server-started", initialize); +end + local function not_implemented() error "not implemented"; end
