docs(roadmap): refactor large code block into smaller snippets

- Split single large bash block into four logical sections (Constants, WS, Auth, Global).
- Improved Obsidian rendering compatibility by removing inline explanatory comments from code blocks.
- Enhanced readability with bold subsection headers.
This commit is contained in:
Murat ÖZDEMİR 2026-05-18 10:48:09 +03:00
parent fb80388b97
commit 2202e92c2c

View File

@ -111,31 +111,41 @@ 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` | | 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` | | Global rule | `limit-count` | `count: 60`, `time_window: 60` per `remote_addr` |
Update the rate limit and connection limit blocks in `init/apisix-core/init.sh`. Define all threshold constants at the script header to ensure consistency and ease of updates: Update the rate limit and connection limit blocks in `init/apisix-core/init.sh`.
**1. Define threshold constants at the script header:**
```bash ```bash
# Define at the top of init.sh
GLOBAL_LIMIT_COUNT=60 GLOBAL_LIMIT_COUNT=60
GLOBAL_LIMIT_WINDOW=60 GLOBAL_LIMIT_WINDOW=60
AUTH_LIMIT_COUNT=12 AUTH_LIMIT_COUNT=12
AUTH_LIMIT_WINDOW=60 AUTH_LIMIT_WINDOW=60
WS_LIMIT_CONN=5 WS_LIMIT_CONN=5
```
# ... later in the script (WebSocket route) ... **2. Update WebSocket route plugins (test/prod):**
```bash
if [[ "$PROFILE" != "dev" ]]; then if [[ "$PROFILE" != "dev" ]]; then
WS_PLUGINS=',"plugins":{"limit-conn":{"conn":'"$WS_LIMIT_CONN"',"burst":2,"default_conn_delay":0.1,"key":"remote_addr","key_type":"var","rejected_code":429}}' WS_PLUGINS=',"plugins":{"limit-conn":{"conn":'"$WS_LIMIT_CONN"',"burst":2,"default_conn_delay":0.1,"key":"remote_addr","key_type":"var","rejected_code":429}}'
else else
WS_PLUGINS="" WS_PLUGINS=""
fi fi
```
# ... later in the script (Auth routes) ... **3. Update Auth route plugins (test/prod):**
```bash
if [[ "$PROFILE" != "dev" ]]; then if [[ "$PROFILE" != "dev" ]]; then
AUTH_LIMIT=',"plugins":{"limit-count":{"count":'"$AUTH_LIMIT_COUNT"',"time_window":'"$AUTH_LIMIT_WINDOW"',"key_type":"var","key":"remote_addr","rejected_code":429,"policy":"local"}}' AUTH_LIMIT=',"plugins":{"limit-count":{"count":'"$AUTH_LIMIT_COUNT"',"time_window":'"$AUTH_LIMIT_WINDOW"',"key_type":"var","key":"remote_addr","rejected_code":429,"policy":"local"}}'
else else
AUTH_LIMIT="" AUTH_LIMIT=""
fi fi
```
# ... later in the script (Global rate limit) ... **4. Update Global rate limit rule (test/prod):**
```bash
if [[ "$PROFILE" != "dev" ]]; then if [[ "$PROFILE" != "dev" ]]; then
if [[ "$PROFILE" == "prod" ]]; then if [[ "$PROFILE" == "prod" ]]; then
RATE_POLICY="redis" RATE_POLICY="redis"