-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
How can I configure the lua_shared_dict to the nginx-kong.conf #4643
Comments
https://github.com/Kong/kong/blob/master/kong/templates/nginx_kong.lua#L31 All these are the declared shared dictionaries kong has by default. You can add as many as you want in that file prior to starting up Kong. Not sure if Kong has introduced a parameter in the conf yet to define custom shared memory zones. |
You can use Nginx directive injection feature to inject a shared dict into the Nginx conf file of Kong:
|
Hello @hbagdi. Is it possible to inject Nginx directives from a plugin ? Asking because of this. I found an ugly workaround using environment variables : BTW, I love your work, guys ! |
@Ilshidur As of today, this is the only way to add a shared dict. Agree that it requires an extra step but should be required only once while setting up configuration for Kong. I'm going to close this as the original question is answered. |
Hi, |
You can include a file with the include directive, which has a number of shared dicts. |
You can set this env var |
Adding for reference; recently saw someone add multiple dicts like this;
EDIT: fixed as correctly identified by @bforbis below |
@Tieske I am unable to configure kong with multiple shared dicts that way: My docker-compose:
The output I get is:
It looks like this env variable will inject the directive into nginx conf as:
So a hacky workaround to this would be to do the following:
which will then generate the following nginx.conf line
|
👍 @bforbis thx for the feedback, I updated my post above |
@Tieske, to be extra clear, you need to add
This does not compile, since "your_dict_name" is not a known nginx directive. |
I want to use the lua_shared_dict in my plugin,but I can not add lua_shared_dict profile in the nginx-kong.conf~How can I do it?
The text was updated successfully, but these errors were encountered: