Set multiple env nginx directives

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?


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ