From e0eb6dacb99078654650181c49128216fe566699 Mon Sep 17 00:00:00 2001 From: moicen Date: Sun, 7 May 2023 02:08:27 +0800 Subject: [PATCH] fix conditional bug --- scripts/lib/upt.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/lib/upt.lua b/scripts/lib/upt.lua index 2507f68..7e17f4c 100644 --- a/scripts/lib/upt.lua +++ b/scripts/lib/upt.lua @@ -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