--[[ 参数:
  registerFrom 灰度设置
  merchantId 灰度设置
  cookie registerFrom值
  cookie merchantId值
]]

local regConfig = ngx.arg[1];
local merConfig = ngx.arg[2];

local regCookie = ngx.arg[3];
local merCookie = ngx.arg[4];

local isGrayReg = false;
local isGrayMer = false;

if (regConfig ~= '' and regCookie~= '' and string.find(regConfig, regCookie)) then
  isGrayReg = true;
end

if (merConfig ~= '' and merCookie ~= '' and string.find(merConfig, merCookie)) then
  isGrayMer = true;
end

local isGray = '';
if (isGrayReg or isGrayMer) then
  isGray = '1';
end

--print(isGray)
return isGray;


  