Changeset

8686:a0f728c3aa69

net.server: Try to require configmanager instead checking for the prosody global which does not yet exist when net.server is loaded now
author Kim Alvefur <zash@zash.se>
date Fri, 23 Mar 2018 18:02:37 +0100
parents 8685:2548111e71d6
children 8687:ee01578c67cb
files net/server.lua
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Fri Mar 23 21:18:15 2018 +0100
+++ b/net/server.lua	Fri Mar 23 18:02:37 2018 +0100
@@ -6,9 +6,13 @@
 -- COPYING file in the source package for more information.
 --
 
-local server_type = prosody and require "core.configmanager".get("*", "network_backend") or "select";
-if prosody and require "core.configmanager".get("*", "use_libevent") then
-	server_type = "event";
+local server_type = "select";
+local ok, configmanager = pcall(require, "core.configmanager");
+if ok then
+	server_type = configmanager.get("*", "network_backend") or "select";
+	if require "core.configmanager".get("*", "use_libevent") then
+		server_type = "event";
+	end
 end
 
 if server_type == "event" then