BOSH: Allow BOSH servers to be configured through config file

Tue, 13 Jan 2009 05:55:31 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 13 Jan 2009 05:55:31 +0000
changeset 701
dc67e3cffff4
parent 700
9666ad50a353
child 709
8bb83563cb21

BOSH: Allow BOSH servers to be configured through config file

plugins/mod_bosh.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_bosh.lua	Mon Jan 12 04:13:05 2009 +0000
+++ b/plugins/mod_bosh.lua	Tue Jan 13 05:55:31 2009 +0000
@@ -253,5 +253,17 @@
 	end
 end
 
-httpserver.new{ port = 5280, base = "http-bind", handler = handle_request, ssl = false}
+local ports = config.get(module.host, "core", "bosh_ports") or { 5280 };
+for _, options in ipairs(ports) do
+	local port, base, ssl, interface = 5280, "http-bind", false, nil;
+	if type(options) == "number" then
+		port = options;
+	elseif type(options) == "table" then
+		port, base, ssl, interface = options.port or 5280, options.path or "http-bind", options.ssl or false, options.interface;
+	elseif type(options) == "string" then
+		base = options;
+	end
+	httpserver.new{ port = port, base = base, handler = handle_request, ssl = ssl }
+end
+
 server.addtimer(on_timer);

mercurial