Skip to content

Commit

Permalink
implement it as a fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske authored and locao committed Apr 16, 2021
1 parent d0d362c commit f0824e2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions kong/db/migrations/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ local function load_subsystems(db, plugin_names)
for _, plugin_name in ipairs(sorted_plugin_names) do
local namespace = ss.namespace:gsub("%*", plugin_name)

-- explicitly load using ".init" since "/?/init.lua" isn't always in a
-- Lua-path by default, see https://github.com/Kong/kong/issues/6867
local ok, mig_idx = utils.load_module_if_exists(namespace .. ".init")
local ok, mig_idx = utils.load_module_if_exists(namespace)

if not ok then
-- fallback to using ".init" since "/?/init.lua" isn't always in a
-- Lua-path by default, see https://github.com/Kong/kong/issues/6867
ok, mig_idx = utils.load_module_if_exists(namespace .. ".init")
end

if ok then
if type(mig_idx) ~= "table" then
return nil, fmt_err(db, "migrations index from '%s' must be a table",
Expand Down

0 comments on commit f0824e2

Please sign in to comment.