You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by we...@apache.org on 2020/10/21 01:59:52 UTC
[apisix] branch master updated: fix: previously we could not merge
configuration without middle layer (#2476)
This is an automated email from the ASF dual-hosted git repository.
wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new d86c480 fix: previously we could not merge configuration without middle layer (#2476)
d86c480 is described below
commit d86c480ec51b70c5c4f56123f8157466a9d35322
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Wed Oct 21 09:59:45 2020 +0800
fix: previously we could not merge configuration without middle layer (#2476)
---
.travis/apisix_cli_test.sh | 26 ++++++++++++++++++++++++++
bin/apisix | 2 ++
2 files changed, 28 insertions(+)
diff --git a/.travis/apisix_cli_test.sh b/.travis/apisix_cli_test.sh
index d98d41b..f4da0f3 100755
--- a/.travis/apisix_cli_test.sh
+++ b/.travis/apisix_cli_test.sh
@@ -23,6 +23,12 @@
set -ex
+clean_up() {
+ git checkout conf/config.yaml
+}
+
+trap clean_up EXIT
+
git checkout conf/config.yaml
# check 'Server: APISIX' is not in nginx.conf. We already added it in Lua code.
@@ -382,3 +388,23 @@ if [ ! $? -eq 0 ]; then
fi
echo "pass: show WARNING message if the user used default token and allow any IP to access"
+
+# allow to merge configuration without middle layer
+
+git checkout conf/config.yaml
+
+echo '
+nginx_config:
+ http:
+ lua_shared_dicts:
+ my_dict: 1m
+' > conf/config.yaml
+
+make init
+
+if ! grep "lua_shared_dict my_dict 1m;" conf/nginx.conf > /dev/null; then
+ echo "failed: 'my_dict' not in nginx.conf"
+ exit 1
+fi
+
+echo "passed: found 'my_dict' in nginx.conf"
diff --git a/bin/apisix b/bin/apisix
index 71a8434..c072269 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -611,6 +611,8 @@ local function merge_conf(base, new_tab)
if type(val) == "table" then
if tab_is_array(val) then
base[key] = val
+ elseif base[key] == nil then
+ base[key] = val
else
merge_conf(base[key], val)
end