diff --git a/roadmap/prod-env/03-infra-stack-changes.md b/roadmap/prod-env/03-infra-stack-changes.md index d288ee2..d3b442a 100644 --- a/roadmap/prod-env/03-infra-stack-changes.md +++ b/roadmap/prod-env/03-infra-stack-changes.md @@ -111,9 +111,14 @@ Keep the following APISIX plugin limits in `init/apisix-core/init.sh` for `test/ | Auth routes `/v1/auth/*`, `/v1/users/*` | `limit-count` | `count: 12`, `time_window: 60` per `remote_addr` | | Global rule | `limit-count` | `count: 60`, `time_window: 60` per `remote_addr` | -Update the global rate limit block in `init/apisix-core/init.sh`: +Update the global rate limit block in `init/apisix-core/init.sh`. Define threshold constants at the script header to ensure consistency and ease of updates: ```bash +# Define at the top of init.sh +GLOBAL_LIMIT_COUNT=60 +GLOBAL_LIMIT_WINDOW=60 + +# ... later in the script ... if [[ "$PROFILE" != "dev" ]]; then if [[ "$PROFILE" == "prod" ]]; then RATE_POLICY="redis" @@ -125,7 +130,7 @@ if [[ "$PROFILE" != "dev" ]]; then call_api "global rate limit" -X PUT "$APISIX_ADMIN_URL/global_rules/1" \ -H "X-API-KEY: $API_KEY" -H "Content-Type: application/json" \ - -d '{"plugins":{"limit-count":{"count":60,"time_window":60,"key_type":"var","key":"remote_addr","rejected_code":429,"policy":"'"$RATE_POLICY"'","allow_degradation":true'"$RATE_REDIS"'}}}' + -d '{"plugins":{"limit-count":{"count":'"$GLOBAL_LIMIT_COUNT"',"time_window":'"$GLOBAL_LIMIT_WINDOW"',"key_type":"var","key":"remote_addr","rejected_code":429,"policy":"'"$RATE_POLICY"'","allow_degradation":true'"$RATE_REDIS"'}}}' fi ```