# HG changeset patch # User Kim Alvefur # Date 1736522367 -3600 # Node ID dde2803f7678d670c29795b906ecb51640e9d695 # Parent f267133c206fb6b8492fa3e67e81b036a25341c5 mod_persisthosts: Retrieve hosts from config instead of Prosody state This should avoid missing hosts that are activated after the one this module was loaded from. diff -r f267133c206f -r dde2803f7678 mod_persisthosts/mod_persisthosts.lua --- a/mod_persisthosts/mod_persisthosts.lua Fri Jan 10 12:35:48 2025 +0100 +++ b/mod_persisthosts/mod_persisthosts.lua Fri Jan 10 16:19:27 2025 +0100 @@ -1,6 +1,7 @@ -- mod_persisthosts module:set_global(); +local cm = require "core.configmanager"; local set = require"util.set"; local stat = require"lfs".attributes; local resolve_relative_path = require"core.configmanager".resolve_relative_path; @@ -9,7 +10,11 @@ local path_pattern = resolve_relative_path(prosody.paths.config, vhost_path) .. "/%s.cfg.lua"; local original = set.new(); -original:include(prosody.hosts); +for host, config in pairs(cm.getconfig()) do + if config["defined"] then + original:add(host); + end +end module:hook("host-activated", function(host) if not original:contains(host) then