This is an automated email from the ASF dual-hosted git repository. AlinsRan pushed a commit to branch issue/12884/pulling-env-vars-in-yaml-keys-works-but-results-in-error-message-in-logs in repository https://gitbox.apache.org/repos/asf/apisix.git
commit 48377ec4b274ea612db313ca11e13ddbdccce614 Author: AlinsRan <[email protected]> AuthorDate: Wed Jul 8 08:36:26 2026 +0800 test: add env var used as config key resolution test --- t/cli/test_http_config.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/cli/test_http_config.sh b/t/cli/test_http_config.sh index 4059ca69a..7b8bc7e96 100755 --- a/t/cli/test_http_config.sh +++ b/t/cli/test_http_config.sh @@ -39,6 +39,31 @@ echo "passed: define custom shdict" git checkout conf/config.yaml +# resolve environment variable used as a config key: the resolved key must be +# rendered and the stale unresolved key must be removed from the config table +echo ' +nginx_config: + http: + custom_lua_shared_dict: + "${{DICT_NAME}}": 1m +' > conf/config.yaml + +DICT_NAME=env_dict make init + +if ! grep "lua_shared_dict env_dict 1m;" conf/nginx.conf > /dev/null; then + echo "failed: resolve env var used as config key" + exit 1 +fi + +if grep -F '${{DICT_NAME}}' conf/nginx.conf > /dev/null; then + echo "failed: stale unresolved env var key should be removed" + exit 1 +fi + +echo "passed: resolve env var used as config key" + +git checkout conf/config.yaml + echo " plugins: - ip-restriction
