Software /
code /
prosody
Diff
plugins/mod_httpserver.lua @ 2355:08f02de5ab9d
mod_httpserver: Delay setup until after server is started.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 10 Dec 2009 16:21:33 +0500 |
parent | 1870:5b5e4a4ecb55 |
child | 2356:6d1e745a96f8 |
line wrap: on
line diff
--- a/plugins/mod_httpserver.lua Thu Dec 10 16:21:06 2009 +0500 +++ b/plugins/mod_httpserver.lua Thu Dec 10 16:21:33 2009 +0500 @@ -56,6 +56,13 @@ return serve_file(path); end -local ports = config.get(module.host, "core", "http_ports") or { 5280 }; -httpserver.set_default_handler(handle_default_request); -httpserver.new_from_config(ports, handle_file_request, { base = "files" }); +local function setup() + local ports = config.get(module.host, "core", "http_ports") or { 5280 }; + httpserver.set_default_handler(handle_default_request); + httpserver.new_from_config(ports, handle_file_request, { base = "files" }); +end +if prosody.start_time then -- already started + setup(); +else + prosody.events.add_handler("server-started", setup); +end