This is an automated email from the ASF dual-hosted git repository.

traky pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 686a0de14 docs: allow to use environment variables for limit-count 
plugin settings (#10804)
686a0de14 is described below

commit 686a0de14c005805a8e4e71b85769aa898c07fd7
Author: baiyun <[email protected]>
AuthorDate: Fri Jan 12 13:57:51 2024 +0800

    docs: allow to use environment variables for limit-count plugin settings 
(#10804)
---
 docs/zh/latest/plugins/limit-count.md | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/docs/zh/latest/plugins/limit-count.md 
b/docs/zh/latest/plugins/limit-count.md
index dbacdfa00..79b3ac4fe 100644
--- a/docs/zh/latest/plugins/limit-count.md
+++ b/docs/zh/latest/plugins/limit-count.md
@@ -250,6 +250,37 @@ curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
 }'
 ```
 
+此外,插件中的属性值可以引用 APISIX 中的密钥。APISIX 当前支持两种存储密钥的方式 - [环境变量和 HashiCorp 
Vault](../terminology/secret.md)。
+如果您设置了环境变量 `REDIS_HOST` 和 `REDIS_PASSWORD` ,如下所示,您可以在插件配置中使用它们:
+
+```shell
+curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "limit-count": {
+            "count": 2,
+            "time_window": 60,
+            "rejected_code": 503,
+            "key": "remote_addr",
+            "policy": "redis",
+            "redis_host": "$ENV://REDIS_HOST",
+            "redis_port": 6379,
+            "redis_password": "$ENV://REDIS_PASSWORD",
+            "redis_database": 1,
+            "redis_timeout": 1001
+        }
+    },
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+```
+
 ## 测试插件
 
 在上文提到的配置中,其限制了 60 秒内请求只能访问 2 次,可通过如下 `curl` 命令测试请求访问:

Reply via email to