Comparison

plugins/mod_turn_external.lua @ 13209:c8d949cf6b09

plugins: Switch to :get_option_period() for time range options Improves readability ("1 day" vs 86400) and centralizes validation.
author Kim Alvefur <zash@zash.se>
date Sun, 16 Jul 2023 20:49:33 +0200
parent 12977:74b9e05af71e
child 13213:50324f66ca2a
comparison
equal deleted inserted replaced
13208:a7c6ea1c5308 13209:c8d949cf6b09
2 2
3 local secret = module:get_option_string("turn_external_secret"); 3 local secret = module:get_option_string("turn_external_secret");
4 local host = module:get_option_string("turn_external_host", module.host); 4 local host = module:get_option_string("turn_external_host", module.host);
5 local user = module:get_option_string("turn_external_user"); 5 local user = module:get_option_string("turn_external_user");
6 local port = module:get_option_number("turn_external_port", 3478); 6 local port = module:get_option_number("turn_external_port", 3478);
7 local ttl = module:get_option_number("turn_external_ttl", 86400); 7 local ttl = module:get_option_period("turn_external_ttl", "1 day");
8 local tcp = module:get_option_boolean("turn_external_tcp", false); 8 local tcp = module:get_option_boolean("turn_external_tcp", false);
9 local tls_port = module:get_option_number("turn_external_tls_port"); 9 local tls_port = module:get_option_number("turn_external_tls_port");
10 10
11 if not secret then 11 if not secret then
12 module:log_status("error", "Failed to initialize: the 'turn_external_secret' option is not set in your configuration"); 12 module:log_status("error", "Failed to initialize: the 'turn_external_secret' option is not set in your configuration");