Skip to content

Commit

Permalink
refactor(core): remove plugin init() function
Browse files Browse the repository at this point in the history
The init() function added in ea85db8 was perceived to have
too little overall value.  It is thus removed.
  • Loading branch information
hanshuebner committed Sep 13, 2023
1 parent 1c4d6b5 commit fd95058
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
25 changes: 0 additions & 25 deletions kong/db/dao/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -355,29 +355,4 @@ function Plugins:get_handlers()
return list
end

function Plugins:execute_plugin_init()
local handlers, err = self:get_handlers()
if not handlers then
return nil, err
end

local errors

for _, handler in ipairs(handlers) do
if implements(handler.handler, "init") then
local ok, err = pcall(handler.handler.init, handler.handler)
if not ok then
errors = errors or {}
errors[#errors + 1] = "on plugin '" .. handler.name .. "': " .. tostring(err)
end
end
end

if errors then
return nil, "error executing plugin init: " .. table.concat(errors, "; ")
end

return true
end

return Plugins
2 changes: 0 additions & 2 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,6 @@ function Kong.init()
-- Load plugins as late as possible so that everything is set up
assert(db.plugins:load_plugin_schemas(config.loaded_plugins))

assert(db.plugins:execute_plugin_init())

if is_stream_module then
stream_api.load_handlers()
end
Expand Down

0 comments on commit fd95058

Please sign in to comment.