From 8858b071033633f2b06c7985b436fb2311dcb144 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 22 Mar 2018 22:35:39 +0000 Subject: util.startup: Expose make_host() function --- util/startup.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'util/startup.lua') diff --git a/util/startup.lua b/util/startup.lua index d8f67d4e..40c328d5 100644 --- a/util/startup.lua +++ b/util/startup.lua @@ -461,24 +461,25 @@ function startup.check_unwriteable() end end +function startup.make_host(hostname) + return { + type = "local", + events = prosody.events, + modules = {}, + sessions = {}, + users = require "core.usermanager".new_null_provider(hostname) + }; +end + function startup.make_dummy_hosts() -- When running under prosodyctl, we don't want to -- fully initialize the server, so we populate prosody.hosts -- with just enough things for most code to work correctly -- luacheck: ignore 122/hosts prosody.core_post_stanza = function () end; -- TODO: mod_router! - local function make_host(hostname) - return { - type = "local", - events = prosody.events, - modules = {}, - sessions = {}, - users = require "core.usermanager".new_null_provider(hostname) - }; - end for hostname in pairs(config.getconfig()) do - hosts[hostname] = make_host(hostname); + hosts[hostname] = startup.make_host(hostname); end end -- cgit v1.2.3