kevinw66 commented on a change in pull request #5675:
URL: https://github.com/apache/apisix/pull/5675#discussion_r762595361
##########
File path: t/cli/test_main.sh
##########
@@ -310,6 +310,45 @@ fi
echo "pass: support environment variables in local_conf"
+# should use default value when environment not set
+echo '
+tests:
+ key: ${{TEST_ENV::1.1.1.1}}
+' > conf/config.yaml
+
+make init
+
+if ! grep "env TEST_ENV=1.1.1.1;" conf/nginx.conf > /dev/null; then
+ echo "failed: should use default value when environment not set"
+ exit 1
+fi
+
+echo '
+tests:
+ key:
${{TEST_ENV::very-long-domain-with-many-symbols.absolutely-non-exists-123ss.com:1234/path?param1=value1}}
+' > conf/config.yaml
+
+make init
+
+if ! grep "env
TEST_ENV=very-long-domain-with-many-symbols.absolutely-non-exists-123ss.com:1234/path?param1=value1;"
conf/nginx.conf > /dev/null; then
+ echo "failed: should use default value when environment not set"
+ exit 1
+fi
+
+echo '
+tests:
+ key: ${{TEST_ENV::192.168.1.1}}
+' > conf/config.yaml
+
+TEST_ENV=127.0.0.1 make init
+
+if ! grep "env TEST_ENV=127.0.0.1;" conf/nginx.conf > /dev/null; then
+ echo "failed: should use default value when environment not set"
+ exit 1
+fi
+
+echo "pass: should use default value when environment not set"
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]