@@ -11,6 +11,7 @@ local host_normalize = require "api-umbrella.utils.host_normalize"
1111local invert_table = require " api-umbrella.utils.invert_table"
1212local is_empty = require " api-umbrella.utils.is_empty"
1313local isfile = require (" pl.path" ).isfile
14+ local iso8601_to_timestamp = require (" api-umbrella.utils.time" ).iso8601_to_timestamp
1415local json_decode = require (" cjson" ).decode
1516local json_encode = require " api-umbrella.utils.json_encode"
1617local mkdir_p = require " api-umbrella.utils.mkdir_p"
@@ -19,6 +20,7 @@ local path_exists = require "api-umbrella.utils.path_exists"
1920local path_join = require " api-umbrella.utils.path_join"
2021local pl_utils = require " pl.utils"
2122local random_token = require " api-umbrella.utils.random_token"
23+ local set_hostname_regex = require " api-umbrella.utils.active_config_store.set_hostname_regex"
2224local shell_blocking_capture = require (" shell-games" ).capture
2325local stat = require " posix.sys.stat"
2426local strip = require (" pl.stringx" ).strip
@@ -179,6 +181,8 @@ local function set_computed_config(config)
179181
180182 local default_host_exists = false
181183 for _ , host in ipairs (config [" hosts" ]) do
184+ set_hostname_regex (host , " hostname" )
185+
182186 if host [" default" ] then
183187 default_host_exists = true
184188 end
@@ -188,6 +192,15 @@ local function set_computed_config(config)
188192 else
189193 host [" _nginx_server_name" ] = host [" hostname" ]
190194 end
195+
196+ if host [" scheduled_brownouts" ] then
197+ for _ , scheduled_brownout in ipairs (host [" scheduled_brownouts" ]) do
198+ for _ , schedule in ipairs (scheduled_brownout [" schedule" ]) do
199+ schedule [" _start_time_timestamp" ] = iso8601_to_timestamp (schedule [" start_time" ])
200+ schedule [" _end_time_timestamp" ] = iso8601_to_timestamp (schedule [" end_time" ])
201+ end
202+ end
203+ end
191204 end
192205
193206 -- If a default host hasn't been explicitly defined, then add a default
0 commit comments