fix conditional bug

This commit is contained in:
moicen
2023-05-07 02:08:27 +08:00
parent bd2743e884
commit e0eb6dacb9
+9 -5
View File
@@ -15,11 +15,15 @@ end
function _M.upt(uri)
local hostname = host(uri)
local upt_table = {}
upt_table["moicen.com"] = ngx.var.upt_moicen_secret,
upt_table["alchemy-studio.cn"] = ngx.var.upt_alchemy_secret,
upt_table["huiwings.cn"] = ngx.var.upt_huiwings_secret
local secret = upt_table[hostname]
local secret;
if (hostname == 'moicen.com') then
secret = ngx.var.upt_moicen_secret
else if hostname == "alchemy-studio.cn" then
secret = ngx.var.upt_alchemy_secret
else if hostname == "huiwings.cn" then
secret = ngx.var.upt_huiwings_secret
end
ngx.log(ngx.INFO, 'url...' .. uri .. ' host...' .. hostname .. 'secret...' .. secret)
local duration = ngx.var.upt_duration
local etime = os.time() + duration