Skip to content

Commit e3cf2bf

Browse files
committed
[remote_v2] small code cleanup
1 parent 9f3fb43 commit e3cf2bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gateway/src/apicast/configuration_loader/remote_v2.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function _M:index_per_service()
176176

177177
local service_regexp_filter = resty_env.value("APICAST_SERVICES_FILTER_BY_URL")
178178
if service_regexp_filter then
179-
local _, err = match("", service_regexp_filter, 'oj')
179+
_, err = match("", service_regexp_filter, 'oj')
180180
if err then
181181
ngx.log(ngx.ERR, "APICAST_SERVICES_FILTER_BY_URL cannot compile, all services will be used: ", err)
182182
service_regexp_filter = nil
@@ -351,7 +351,11 @@ local function services_subset()
351351
local services = resty_env.value('APICAST_SERVICES_LIST') or resty_env.value('APICAST_SERVICES')
352352
if resty_env.value('APICAST_SERVICES') then ngx.log(ngx.WARN, 'DEPRECATION NOTICE: Use APICAST_SERVICES_LIST not APICAST_SERVICES as this will soon be unsupported') end
353353
if services and len(services) > 0 then
354-
local ids = re.split(services, ',', 'oj')
354+
local ids, err = re.split(services, ',', 'oj')
355+
if not ids then
356+
return nil, err
357+
end
358+
355359
for i=1, #ids do
356360
ids[i] = { service = { id = tonumber(ids[i]) } }
357361
end

0 commit comments

Comments
 (0)