From d5391f75daa121c3141b617009e6540a4eef0cf9 Mon Sep 17 00:00:00 2001 From: MStokluska Date: Mon, 23 Sep 2024 10:47:36 +0100 Subject: [PATCH] THREESCALE-10675 apicast crashloop when setting large number of APICAST_SERVICES_LIST --- gateway/http.d/init.conf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/gateway/http.d/init.conf b/gateway/http.d/init.conf index 55a8764ce..83a515c9e 100644 --- a/gateway/http.d/init.conf +++ b/gateway/http.d/init.conf @@ -44,15 +44,9 @@ init_by_lua_block { require("resty.core") local resty_env = require('resty.env') - -- WARNING, WARNING, WARNING: this is insane hack and should not be touched - -- This file is not templated by Liquid, because it is used by not blackbox integration tests (Search for TEST_NGINX_HTTP_CONFIG). - -- So it cannot be templated by liquid, to lift env variables and persist them in the configuration. - -- This is a workaround so we can store environment at the time of building the config into the config itself. - -- {% raw %} {{ ENV }} {% endraw %} is both valid Liquid template and Lua code. - -- In Lua it is a table with another empty table inside. In Liquid it prints variable ENV. - -- This ENV variable is defined in the main nginx.conf.liquid and injected when including this partial. - -- The content of the ENV variable is a Lua table, so when rendered it actually can run ipairs on it. - for k,v in pairs({{ ENV }}) do + local env_vars = resty_env.list() + + for k, v in pairs(env_vars) do if type(k) == 'string' and not resty_env.value(k) then resty_env.set(k,v) end