-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.example
More file actions
65 lines (53 loc) · 2.23 KB
/
env.example
File metadata and controls
65 lines (53 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Admin Panel Password (REQUIRED - Change this!)
# 方式 1: 使用明文密碼(不推薦,僅用於開發)
ADMIN_PASSWORD=your_secure_password_here
# 方式 2: 使用雜湊密碼(推薦,用於生產環境)
# 使用以下命令生成雜湊(會安全提示輸入密碼): python server/scripts/hash_password.py
# ADMIN_PASSWORD_HASHED=$2b$12$...
# Server Configuration
PORT=4000
WS_PORT=4001
ENV=production
HTTP_PORT=80
HTTPS_PORT=443
# Settings Persistence (可選)
# 設定持久化檔案路徑(顏色/字體/速度等);若不設定,預設會寫入系統暫存目錄
# SETTINGS_FILE=/path/to/danmu_runtime_settings.json
# Security
SECRET_KEY= # Leave empty to auto-generate, or set a secure random string
# Rate Limiting (可選,使用預設值即可)
FIRE_RATE_LIMIT=20
FIRE_RATE_WINDOW=60
ADMIN_RATE_LIMIT=60
ADMIN_RATE_WINDOW=60
API_RATE_LIMIT=30
API_RATE_WINDOW=60
RATE_LIMIT_BACKEND=memory # Options: memory, redis
# Redis Configuration (僅在使用 redis 後端時需要)
REDIS_URL=redis://localhost:6379/0
# Logging (可選)
LOG_LEVEL=INFO
LOG_FORMAT=text # Options: text, json
# Security (可選,使用預設值即可)
FONT_TOKEN_EXPIRATION=900 # 字型 token 有效期限(秒)
SESSION_COOKIE_SECURE=true # 反向代理走 HTTPS 時應為 true
SESSION_COOKIE_SAMESITE=Lax # Options: Strict, Lax, None
CORS_ORIGINS=* # 逗號分隔的允許來源
TRUSTED_HOSTS=localhost,127.0.0.1 # 生產環境請改為你的網域
TRUST_X_FORWARDED_FOR=false # 僅在信任的反向代理後方才啟用
# Dedicated WebSocket server hardening
WS_REQUIRE_TOKEN=true
WS_AUTH_TOKEN=
WS_ALLOWED_ORIGINS= # 例: https://danmu.example.com
WEB_WS_ALLOWED_ORIGINS= # 可選;未設定時 web WS 僅允許同源 Origin
# Dedicated WebSocket limits (DoS 防護,可選)
WS_MAX_SIZE=1048576 # 單一訊息最大 bytes(預設 1MB)
WS_MAX_QUEUE=16 # 接收佇列上限
WS_WRITE_LIMIT=32768 # 寫入緩衝上限 bytes
# Optional HTTPS reverse proxy (docker compose --profile https)
# Put certificate files at:
# nginx/certs/fullchain.pem
# nginx/certs/privkey.pem
# Danmu History (可選,使用預設值即可)
DANMU_HISTORY_MAX_RECORDS=10000 # 最大記錄數
DANMU_HISTORY_CLEANUP_HOURS=24 # 自動清理超過此小時數的記錄