Diff

net/server.lua @ 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
parent 7546:9606a99f8617
child 8700:d611c46c6787
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