Software /
code /
prosody-modules
Changeset
6146:dde2803f7678
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 Jan 2025 16:19:27 +0100 |
parents | 6145:f267133c206f |
children | 6147:6ba0489e4828 |
files | mod_persisthosts/mod_persisthosts.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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