Mercurial > prosody-modules
comparison mod_register_json/mod_register_json.lua @ 358:4483bb889d12
mod_register_json: Minor refactor, default to port 9280 if option is unspecified or default to port 9443 if SSL is used. (Good, bad?)
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Tue, 12 Apr 2011 17:47:47 +0000 |
parents | 59345fd38ad9 |
children | 5d22ebcb9ec5 |
comparison
equal
deleted
inserted
replaced
357:59345fd38ad9 | 358:4483bb889d12 |
---|---|
61 end | 61 end |
62 end | 62 end |
63 end | 63 end |
64 | 64 |
65 local function setup() | 65 local function setup() |
66 local ports = module:get_option("reg_servlet_port") or { 9443 }; | 66 local ports = module:get_option("reg_servlet_port") or { 9280 }; |
67 local base_name = module:get_option("reg_servlet_base") or "register_account"; | 67 local base_name = module:get_option("reg_servlet_base") or "register_account"; |
68 local ssl_cert = module:get_option("reg_servlet_sslcert") or false; | 68 local ssl_cert = module:get_option("reg_servlet_sslcert") or false; |
69 local ssl_key = module:get_option("reg_servlet_sslkey") or false; | 69 local ssl_key = module:get_option("reg_servlet_sslkey") or false; |
70 if not ssl_cert or not ssl_key then | 70 if not ssl_cert or not ssl_key then |
71 require "net.httpserver".new_from_config(ports, handle_req, { base = base_name }); | 71 require "net.httpserver".new_from_config(ports, handle_req, { base = base_name }); |
72 else | 72 else |
73 if module:get_option("reg_servlet_port") == nil then ports = { 9443 }; end | |
73 require "net.httpserver".new_from_config(ports, handle_req, { ssl = { key = ssl_key, certificate = ssl_cert }, base = base_name }); | 74 require "net.httpserver".new_from_config(ports, handle_req, { ssl = { key = ssl_key, certificate = ssl_cert }, base = base_name }); |
74 end | 75 end |
75 end | 76 end |
76 if prosody.start_time then -- already started | 77 if prosody.start_time then -- already started |
77 setup(); | 78 setup(); |