Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 13 additions & 6 deletions gateway/conf/nginx.conf.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ http {
resolver {{ nameservers | join: " " }};
{% endif %}

{%- comment -%}
Capture environment variables for init.conf, excluding APICAST_SERVICES_LIST which can be
very large and hit NGINX parser limits. APICAST_SERVICES_LIST is cached separately in
init.conf using os.getenv() during init phase before the environment is cleared.
{%- endcomment -%}
{%- capture ENV -%}
{
{%- for env in env -%}
{%- if env.name | starts_with: 'APICAST_', 'THREESCALE_' %}
[ [[{{ env.name }}]] ] = [[{{ env.value }}]],
{%- endif -%}
{
{%- for env in env -%}
{%- if env.name | starts_with: 'APICAST_', 'THREESCALE_' %}
{%- unless env.name == 'APICAST_SERVICES_LIST' %}
[ [[{{ env.name }}]] ] = [[{{ env.value }}]],
{%- endunless -%}
{%- endif -%}
{%- endfor %}
}
}
{%- endcapture -%}

{% for file in "http.d/*.conf" | filesystem %}
Expand Down
5 changes: 5 additions & 0 deletions gateway/http.d/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ init_by_lua_block {
end
end

local services_list = os.getenv('APICAST_SERVICES_LIST')
if services_list and not resty_env.value('APICAST_SERVICES_LIST') then
resty_env.set('APICAST_SERVICES_LIST', services_list)
end

require('resty.resolver').init()

require('apicast.loader')
Expand Down
Loading