Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
116 lines (97 loc) · 4.39 KB
/
Copy path.env.example
File metadata and controls
116 lines (97 loc) · 4.39 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# ============================================
# ProtoForge 核心配置
# ============================================
# Web 服务监听地址和端口
PROTOFORGE_HOST=0.0.0.0
PROTOFORGE_PORT=8000
# 数据库配置
# SQLite(默认,适合开发和单机部署):
PROTOFORGE_DB_PATH=data/protoforge.db
# PostgreSQL(生产环境推荐):
# 格式: postgresql://用户名:密码@主机:端口/数据库名?sslmode=require
# 请通过环境变量或 Docker Secrets 注入凭据,切勿硬编码
# Docker Compose 使用时,请在 .env 中设置完整的 PROTOFORGE_DB_PATH
# 示例: PROTOFORGE_DB_PATH=postgresql://protoforge:你的密码@postgres:5432/protoforge
# PROTOFORGE_DB_PATH=postgresql://USER:PASS@localhost:5432/protoforge?sslmode=require
# Docker Compose PostgreSQL 测试数据库 URL
# PROTOFORGE_DB_PATH_TEST=postgresql://protoforge:你的密码@postgres:5432/protoforge_test
# Docker Compose PostgreSQL 密码(使用 PostgreSQL 时必须设置):
PROTOFORGE_DB_PASSWORD=
# JWT 密钥(重要:生产环境必须修改!)
# 留空将在首次启动时自动生成随机密钥,但重启后所有 Token 会失效(导致 401 错误)
# 生产环境请设置为 32 字节以上的随机字符串:python -c "import secrets; print(secrets.token_urlsafe(32))"
PROTOFORGE_JWT_SECRET=protoforge_change_this_jwt_secret_in_production_2026
# 演示模式(启动时自动创建示例设备)
PROTOFORGE_DEMO_MODE=false
# 日志级别:debug, info, warning, error
PROTOFORGE_LOG_LEVEL=info
# CORS 允许源(多个用逗号分隔)
# 生产环境必须设置为具体域名,如:https://protoforge.example.com
PROTOFORGE_CORS_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
# 禁用认证(仅用于开发和测试,生产环境切勿启用)
# PROTOFORGE_NO_AUTH=false
# 管理员初始密码(默认: admin,生产环境必须设置强密码!)
PROTOFORGE_ADMIN_PASSWORD=admin
# 重置管理员密码(设为 true 时,启动会用 PROTOFORGE_ADMIN_PASSWORD 的值覆盖数据库中的 admin 密码)
# 修改密码后建议改回 false,避免每次重启都重置
PROTOFORGE_RESET_ADMIN_PASSWORD=false
# 最小密码长度(默认: 4,生产环境建议设为 8+)
PROTOFORGE_MIN_PASSWORD_LENGTH=8
# Token 有效期(秒)
# PROTOFORGE_ACCESS_TOKEN_EXPIRES=86400
# PROTOFORGE_REFRESH_TOKEN_EXPIRES=604800
# 登录安全策略
# PROTOFORGE_MAX_LOGIN_ATTEMPTS=5
# PROTOFORGE_LOCKOUT_DURATION=300
# ============================================
# InfluxDB 数据转发配置(可选)
# ============================================
# PROTOFORGE_INFLUXDB_URL=http://localhost:8086
# PROTOFORGE_INFLUXDB_TOKEN=your-influxdb-token
# PROTOFORGE_INFLUXDB_ORG=default
# PROTOFORGE_INFLUXDB_BUCKET=protoforge
# ============================================
# EdgeLite 网关集成配置(可选)
# ============================================
# PROTOFORGE_EDGELITE_URL=http://localhost:8080
# PROTOFORGE_EDGELITE_USERNAME=admin
# PROTOFORGE_EDGELITE_PASSWORD=
# ============================================
# 协议端口配置
# ============================================
PROTOFORGE_MODBUS_TCP_PORT=5020
# PROTOFORGE_MODBUS_RTU_PORT= (留空自动识别:Windows=COM1, Linux=/dev/ttyUSB0)
PROTOFORGE_OPCUA_PORT=4840
PROTOFORGE_MQTT_PORT=1883
PROTOFORGE_HTTP_PORT=8080
PROTOFORGE_GB28181_PORT=5060
PROTOFORGE_BACNET_PORT=47808
PROTOFORGE_S7_PORT=102
PROTOFORGE_MC_PORT=5000
PROTOFORGE_FINS_PORT=9600
PROTOFORGE_AB_PORT=44818
PROTOFORGE_OPCDA_PORT=51340
PROTOFORGE_FANUC_PORT=8193
PROTOFORGE_MTCONNECT_PORT=7878
PROTOFORGE_TOLEDO_PORT=1701
PROTOFORGE_PROFINET_PORT=34964
PROTOFORGE_ETHERCAT_PORT=34980
# ============================================
# 高可用/故障转移配置(可选)
# ============================================
# PROTOFORGE_FAILOVER_ROLE=primary
# PROTOFORGE_FAILOVER_PRIMARY=http://localhost:8000
# PROTOFORGE_FAILOVER_STANDBY=http://localhost:8001
# PROTOFORGE_FAILOVER_INTERVAL=10
# ============================================
# gRPC 服务配置(可选,默认禁用)
# 设为 0 禁用,设为端口号(如 50051)启用
# ============================================
PROTOFORGE_GRPC_PORT=0
# ============================================
# API 限流配置
# ============================================
# PROTOFORGE_RATE_LIMIT_MAX_REQUESTS=100
# PROTOFORGE_RATE_LIMIT_WINDOW_SECONDS=60
# PROTOFORGE_RATE_LIMIT_AUTH_MAX_REQUESTS=10
# PROTOFORGE_RATE_LIMIT_AUTH_WINDOW_SECONDS=60