Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Oct 22, 2024
1 parent 9936bd7 commit 22aa630
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions kong/tls/plugins/sni_filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,41 @@ local function each_enabled_plugin(entity, plugin_name)
return iterator
end

local workspaces_iter
do
local pok = pcall(require, "kong.workspaces")
if not pok then
-- no workspace support, that's fine
workspaces_iter = function(_) return next, { default = {} }, nil end

else
workspaces_iter = function(db)
ngx.log(ngx.ERR, "using workspace support")
return db.workspaces:each(1000)
end
end
end

function _M.build_ssl_route_filter_set(plugin_name)
kong.log.debug("building ssl route filter set for plugin name " .. plugin_name)
local db = kong.db
local snis = {}
local options = {}

local options = { workspace = null }
for plugin, err in each_enabled_plugin(db.plugins, plugin_name) do
for plugin, err in kong.db.plugins:each() do
if err then
return nil, "could not load plugins: " .. err
end

local err = get_snis_for_plugin(db, plugin, snis, options)
if err then
return nil, err
if plugin.enabled and plugin.name == plugin_name then
local err = get_snis_for_plugin(db, plugin, snis, options)
if err then
return nil, err
end

if snis["*"] then
break
end
end
end

Expand Down

0 comments on commit 22aa630

Please sign in to comment.