Software /
code /
prosody
Changeset
13237:59c3d775c7fa
core.moduleapi: Parse period min/max arguments
Allows specifying them the same way as the default and in the config,
for consistency
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 22 Jul 2023 12:08:01 +0200 |
parents | 13236:9c72f93b7a02 |
children | 13238:26327eac56dc |
files | core/moduleapi.lua |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/core/moduleapi.lua Fri Jul 21 18:30:06 2023 +0200 +++ b/core/moduleapi.lua Sat Jul 22 12:08:01 2023 +0200 @@ -295,10 +295,16 @@ return math.huge; end + if type(min) == "string" then + min = human_io.parse_duration(min); + end if min and ret < min then self:log("warn", "Config option '%s' out of bounds %g < %g", name, ret, min); return min; end + if type(max) == "string" then + max = human_io.parse_duration(max); + end if max and ret > max then self:log("warn", "Config option '%s' out of bounds %g > %g", name, ret, max); return max;