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:
parent
fb80388b97
commit
2202e92c2c
@ -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` |
|
||||
| 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
|
||||
# Define at the top of init.sh
|
||||
GLOBAL_LIMIT_COUNT=60
|
||||
GLOBAL_LIMIT_WINDOW=60
|
||||
AUTH_LIMIT_COUNT=12
|
||||
AUTH_LIMIT_WINDOW=60
|
||||
WS_LIMIT_CONN=5
|
||||
```
|
||||
|
||||
# ... later in the script (WebSocket route) ...
|
||||
**2. Update WebSocket route plugins (test/prod):**
|
||||
|
||||
```bash
|
||||
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}}'
|
||||
else
|
||||
WS_PLUGINS=""
|
||||
fi
|
||||
```
|
||||
|
||||
# ... later in the script (Auth routes) ...
|
||||
**3. Update Auth route plugins (test/prod):**
|
||||
|
||||
```bash
|
||||
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"}}'
|
||||
else
|
||||
AUTH_LIMIT=""
|
||||
fi
|
||||
```
|
||||
|
||||
# ... later in the script (Global rate limit) ...
|
||||
**4. Update Global rate limit rule (test/prod):**
|
||||
|
||||
```bash
|
||||
if [[ "$PROFILE" != "dev" ]]; then
|
||||
if [[ "$PROFILE" == "prod" ]]; then
|
||||
RATE_POLICY="redis"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user