Changeset

8673:6aeed79d9283

util.startup: Expose make_host() function
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Mar 2018 22:35:39 +0000
parents 8672:86b12ae8d427
children 8674:55807a2f5d23
files util/startup.lua
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/util/startup.lua	Thu Mar 22 22:35:27 2018 +0000
+++ b/util/startup.lua	Thu Mar 22 22:35:39 2018 +0000
@@ -461,24 +461,25 @@
 	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