Skip to content

Commit 252c623

Browse files
committed
feat: rename CORS_ALLOW_ORIGIN to ASTRBOT_CORS_ALLOW_ORIGIN and add it to .env.example
1 parent 7b11f90 commit 252c623

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ ASTRBOT_SYSTEMD=1
8080
# 默认 Default: True
8181
ASTRBOT_DASHBOARD_ENABLE=True
8282

83+
# 允许跨域请求的来源域名(多个用逗号分隔,允许所有则用 *)
84+
# Allowed CORS origins for WebUI dashboard (comma-separated, or * for all)
85+
# 示例 Example: https://dash.astrbot.men
86+
# 默认 Default: *
87+
# ASTRBOT_CORS_ALLOW_ORIGIN="*"
88+
8389
# ------------------------------------------
8490
# 国际化配置 / Internationalization Configuration
8591
# ------------------------------------------

astrbot/dashboard/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ def _init_app(self):
236236
self.app.json.sort_keys = False
237237

238238
# 配置 CORS
239-
# 支持通过环境变量 CORS_ALLOW_ORIGIN 配置允许的域名,多个域名用逗号分隔
239+
# 支持通过环境变量 ASTRBOT_CORS_ALLOW_ORIGIN 配置允许的域名,多个域名用逗号分隔
240240
# 如果前端使用 withCredentials:true,需要设置具体的域名而非 "*"
241-
cors_allow_origin = os.environ.get("CORS_ALLOW_ORIGIN", "*")
241+
cors_allow_origin = os.environ.get("ASTRBOT_CORS_ALLOW_ORIGIN", "*")
242242
cors_allow_credentials = False
243243
if cors_allow_origin != "*":
244244
cors_allow_origin = [

0 commit comments

Comments
 (0)