Mercurial > prosody-modules
comparison mod_turncredentials/mod_turncredentials.lua @ 1169:0ae2c250f274
mod_turncredentials: Use type-specific get_option() methods where appropriate, and pass in default values
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 28 Aug 2013 10:35:32 +0100 |
| parents | 0b6b33688b75 |
| children | 6695c3098025 |
comparison
equal
deleted
inserted
replaced
| 1168:0b6b33688b75 | 1169:0ae2c250f274 |
|---|---|
| 4 | 4 |
| 5 local st = require "util.stanza"; | 5 local st = require "util.stanza"; |
| 6 local hmac_sha1 = require "util.hashes".hmac_sha1; | 6 local hmac_sha1 = require "util.hashes".hmac_sha1; |
| 7 local base64 = require "util.encodings".base64; | 7 local base64 = require "util.encodings".base64; |
| 8 local os_time = os.time; | 8 local os_time = os.time; |
| 9 local secret = module:get_option("turncredentials_secret") or false; | 9 local secret = module:get_option_string("turncredentials_secret"); |
| 10 local host = module:get_option("turncredentials_host") or false -- use ip addresses here to avoid further dns lookup latency | 10 local host = module:get_option_string("turncredentials_host"); -- use ip addresses here to avoid further dns lookup latency |
| 11 local port = module:get_option("turncredentials_port") or 3478 | 11 local port = module:get_option_number("turncredentials_port", 3478); |
| 12 local ttl = module:get_option("turncredentials_ttl") or 86400 | 12 local ttl = module:get_option_number("turncredentials_ttl", 86400); |
| 13 if not (secret and host) then | 13 if not (secret and host) then |
| 14 module:log("error", "turncredentials not configured"); | 14 module:log("error", "turncredentials not configured"); |
| 15 return; | 15 return; |
| 16 end | 16 end |
| 17 | 17 |
