Yiyiyimu commented on a change in pull request #2101:
URL: https://github.com/apache/apisix/pull/2101#discussion_r561602243
##########
File path: Makefile
##########
@@ -98,7 +98,7 @@ endif
### stop: Stop the apisix server
.PHONY: stop
stop: default
- $(OR_EXEC) -p $$PWD/ -c $$PWD/conf/nginx.conf -s stop
+ ./bin/apisix stop
Review comment:
sync to init/run
##########
File path: .travis/apisix_cli_test/test_main.sh
##########
@@ -500,6 +500,43 @@ fi
sed -i 's/worker_processes: 2/worker_processes: auto/' conf/config.yaml
echo "passed: worker_processes number is configurable"
+# check customized config.yaml is copied and reverted.
+
+git checkout conf/config.yaml
+
+echo "
+apisix:
+ admin_api_mtls:
+ admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
+ admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
+ port_admin: 9180
+ https_admin: true
+" > conf/customized_config.yaml
+
+make init
+
+./bin/apisix start -c conf/customized_config.yaml
+
+code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code}
https://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1')
+if [ ! $code -eq 200 ]; then
+ echo "failed: customized config.yaml copied failed"
+ exit 1
+fi
+# to revert the customized config and start a new one
+make stop
+
+./bin/apisix start
+
+code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code}
https://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1')
Review comment:
This line would return code `0` since connection refused, so it would be
trapped and `clean_up` will execute
##########
File path: .travis/apisix_cli_test/test_main.sh
##########
@@ -500,6 +500,43 @@ fi
sed -i 's/worker_processes: 2/worker_processes: auto/' conf/config.yaml
echo "passed: worker_processes number is configurable"
+# check customized config.yaml is copied and reverted.
+
+git checkout conf/config.yaml
+
+echo "
+apisix:
+ admin_api_mtls:
+ admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
+ admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
+ port_admin: 9180
+ https_admin: true
+" > conf/customized_config.yaml
+
+make init
+
+./bin/apisix start -c conf/customized_config.yaml
+
+code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code}
https://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1')
+if [ ! $code -eq 200 ]; then
+ echo "failed: customized config.yaml copied failed"
+ exit 1
+fi
+# to revert the customized config and start a new one
+make stop
+
+./bin/apisix start
+
+code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code}
https://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1')
Review comment:
Maybe I could compare if after `make stop`, is `config.yaml` still the
same with the original one
##########
File path: apisix/cli/ops.lua
##########
@@ -390,6 +392,21 @@ local function start(env, ...)
end
end
+ local parser = argparse()
+ parser:argument("_", "Placeholder")
+ parser:option("-c --config", "location of customized config.yaml")
+ local args = parser:parse()
+ local customized_yaml = args["config"]
+
+ profile.apisix_home = env.apisix_home .. "/"
+ local local_conf_path = profile:yaml_path("config")
+
+ if customized_yaml then
+ execute("mv " .. local_conf_path .. " " .. local_conf_path .. ".bak")
Review comment:
PTAL
##########
File path: .github/workflows/lint.yml
##########
@@ -1,6 +1,6 @@
name: ❄️ Lint
-on: [pull_request]
+on: [push, pull_request]
Review comment:
Thanks! Fix the first two unrelated changes.
The last one is what this PR need, otherwise `make stop` could not revert
the `config.yaml.bak`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]