tzssangglass commented on a change in pull request #5675:
URL: https://github.com/apache/apisix/pull/5675#discussion_r761638734



##########
File path: t/cli/test_main.sh
##########
@@ -310,6 +310,35 @@ fi
 
 echo "pass: support environment variables in local_conf"
 
+# support default value when environment not set
+echo '
+etcd:
+    host:
+        - "http://${{ETCD_HOST:192.168.1.1}}:${{ETCD_PORT}}";
+' > conf/config.yaml
+
+ETCD_PORT=2379 make init
+
+if ! grep "env ETCD_HOST=192.168.1.1;" conf/nginx.conf > /dev/null; then
+    echo "failed: support default value when environment not set"
+    exit 1
+fi
+
+echo '
+etcd:
+    host:
+        - "http://${{ETCD_HOST:192.168.1.1}}:${{ETCD_PORT}}";
+' > conf/config.yaml
+
+ETCD_HOST=127.0.0.1 ETCD_PORT=2379 make init
+
+if ! grep "env ETCD_HOST=127.0.0.1;" conf/nginx.conf > /dev/null; then
+    echo "failed: support default value when environment not set"

Review comment:
       ```suggestion
       echo "failed: should use  environment var of ETCD_HOST"
   ```

##########
File path: t/cli/test_main.sh
##########
@@ -310,6 +310,35 @@ fi
 
 echo "pass: support environment variables in local_conf"
 
+# support default value when environment not set
+echo '
+etcd:
+    host:
+        - "http://${{ETCD_HOST:192.168.1.1}}:${{ETCD_PORT}}";

Review comment:
       Can we use an other name? I'm worried that ETCD_HOST may have already 
been set with variables.

##########
File path: t/cli/test_main.sh
##########
@@ -310,6 +310,35 @@ fi
 
 echo "pass: support environment variables in local_conf"
 
+# support default value when environment not set
+echo '
+etcd:
+    host:
+        - "http://${{ETCD_HOST:192.168.1.1}}:${{ETCD_PORT}}";
+' > conf/config.yaml
+
+ETCD_PORT=2379 make init
+
+if ! grep "env ETCD_HOST=192.168.1.1;" conf/nginx.conf > /dev/null; then

Review comment:
       I think it would be more appropriate to check if etcd is connected 
properly from the APISIX error.log.

##########
File path: t/cli/test_main.sh
##########
@@ -310,6 +310,35 @@ fi
 
 echo "pass: support environment variables in local_conf"
 
+# support default value when environment not set
+echo '
+etcd:
+    host:
+        - "http://${{ETCD_HOST:192.168.1.1}}:${{ETCD_PORT}}";
+' > conf/config.yaml
+
+ETCD_PORT=2379 make init
+
+if ! grep "env ETCD_HOST=192.168.1.1;" conf/nginx.conf > /dev/null; then
+    echo "failed: support default value when environment not set"

Review comment:
       ```suggestion
       echo "failed: should use default value when environment not set"
   ```




-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to