AlinsRan commented on code in PR #8901:
URL: https://github.com/apache/apisix/pull/8901#discussion_r1119584788


##########
docs/zh/latest/admin-api.md:
##########
@@ -65,6 +65,46 @@ deployment:
             port: 9180                  # Admin API 监听的 端口,必须使用与 node_listen 
不同的端口。
 ```
 
+### 使用环境变量 {$using-environment-variables}
+
+要通过环境变量进行配置,可以使用 `${{VAR}}` 语法。例如:
+
+```yaml title="./conf/config.yaml"
+deployment:
+  admin:
+    admin_key:
+    - name: admin
+      key: ${{ADMIN_KEY}}
+      role: admin
+    allow_admin:
+    - 127.0.0.0/24
+    admin_listen:
+      ip: 0.0.0.0
+      port: 9180
+```
+
+然后在 `make init` 之前运行 `export ADMIN_KEY=$your_admin_key`.
+
+如果找不到配置的环境变量,将抛出错误。
+
+此外,如果要在未设置环境变量时使用默认值,请改用 `${{VAR:=default_value}}`。例如:
+
+```yaml title="./conf/config.yaml"
+deployment:
+  admin:
+    admin_key:
+    - name: admin
+      key: ${{ADMIN_KEY:=edd1c9f034335f136f87ad84b625c8f1}}
+      role: admin
+    allow_admin:
+    - 127.0.0.0/24
+    admin_listen:
+      ip: 0.0.0.0
+      port: 9180
+```
+
+This will find environment variable `ADMIN_KEY` first, and if it's not exist 
it will use `edd1c9f034335f136f87ad84b625c8f1` as default value

Review Comment:
   Is there anything wrong with that?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to