Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(init) checking that core shared dictionaries exist #2466

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
[Amir M. Saeid](https://github.com/amir) for the contribution.
[#2430](https://github.com/Mashape/kong/pull/2430)
- Logging retries and failure information.
[#2429](https://github.com/Mashape/kong/pull/2429).
[#2429](https://github.com/Mashape/kong/pull/2429)
- Serf commands are now logged with a `DEBUG` log level.
[#2410](https://github.com/Mashape/kong/pull/2410)
- Checking that core Lua shared dictionaries are declared in the configuration.
[#2466](https://github.com/Mashape/kong/pull/2466)
- Plugins:
- :fireworks: **New Request termination plugin**. This plugin allows to
temporarily disable an API and return a pre-configured response status and
Expand Down
9 changes: 9 additions & 0 deletions kong/kong.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,16 @@ end

local Kong = {}

local DICTS = { "kong", "cache", "cache_locks", "process_events", "cassandra"}

function Kong.init()
-- Check shared dictionaries
for _, dict in ipairs(DICTS) do
if not ngx.shared[dict] then
error("cannot find shared dictionary: "..dict)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should instruct the user how to fix this issue:

"missing shared dict in Nginx configuration, are you "      ..
"using a custom template? Make sure the 'lua_shared_dict' " ..
dict .. " [SIZE];" directive is defined."

end
end

local pl_path = require "pl.path"
local conf_loader = require "kong.conf_loader"

Expand Down