diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-12-10 16:21:33 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-12-10 16:21:33 +0500 |
commit | 36710bbfacd0c83eeea1b2bcc29b9d716be1c01e (patch) | |
tree | edeabf290bd10ea49bca2d3e5b87b0330415ca28 /plugins/mod_httpserver.lua | |
parent | 3d65df61e3f4741236d65c8ac3595f9bcf7d8c15 (diff) | |
download | prosody-36710bbfacd0c83eeea1b2bcc29b9d716be1c01e.tar.gz prosody-36710bbfacd0c83eeea1b2bcc29b9d716be1c01e.zip |
mod_httpserver: Delay setup until after server is started.
Diffstat (limited to 'plugins/mod_httpserver.lua')
-rw-r--r-- | plugins/mod_httpserver.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/mod_httpserver.lua b/plugins/mod_httpserver.lua index 545d4faf..57b274ef 100644 --- a/plugins/mod_httpserver.lua +++ b/plugins/mod_httpserver.lua @@ -56,6 +56,13 @@ local function handle_default_request(method, body, request) 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 |