Skip to content

Commit

Permalink
fix(dbless) handle possible errors of declarative_init_build()
Browse files Browse the repository at this point in the history
  • Loading branch information
aboudreault committed May 11, 2022
1 parent c595b35 commit 058f19a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,11 @@ function Kong.init_worker()
-- if there is no declarative config set and a config is present in LMDB,
-- just build the router and plugins iterator
ngx_log(ngx_INFO, "found persisted lmdb config, loading...")
declarative_init_build()
local ok, err = declarative_init_build()
if not ok then
stash_init_worker_error("failed to initialize declarative config: " .. err)
return
end
elseif declarative_entities then
ok, err = load_declarative_config(kong.configuration,
declarative_entities,
Expand All @@ -672,7 +676,11 @@ function Kong.init_worker()
else
-- stream does not need to load declarative config again, just build
-- the router and plugins iterator
declarative_init_build()
local ok, err = declarative_init_build()
if not ok then
stash_init_worker_error("failed to initialize declarative config: " .. err)
return
end
end
end

Expand Down

0 comments on commit 058f19a

Please sign in to comment.