I have a need to expose a few environment variables to Kong via Nginx. The only way I can see to do this is using the following environment variable:
KONG_NGINX_MAIN_ENV=FOO
That will add the following to the nginx.conf file:
#injected nginx_main_* directives
env FOO;
How do I add env BAR to this by using environment variables (which is a limitation of the setup we’re using)
I was able to achieve the goal using the example below, but there has got to be a better way to do it. This is a classic hack.
KONG_NGINX_MAIN_ENV=FOO; env BAR
That adds the following to nginx.conf:
# injected nginx_main_* directives
daemon off;
env FOO; env BAR;
worker_processes auto;
Functional, yes. Ugly, also yes. Anyone have any better, more elegant ways of doing this?
1 Like
Thanks for dropping that insight, I did something similar and it worked.
- env:
- name: KONG_NGINX_MAIN_ENV
value: "SPLUNK_HOST; env KONG_SSL_CERT_KEY; env KONG_SSL_CERT_DER"
Wonder if Kong has made a more elegant way to do this in the last 4 years…