初步实现数据加密、权限管理、日志审计等功能

This commit is contained in:
2026-02-02 10:09:28 +08:00
parent b6b37a453b
commit 807e634318
27 changed files with 3787 additions and 59 deletions

44
.env.example Normal file
View File

@@ -0,0 +1,44 @@
# TJWater Server 环境变量配置模板
# 复制此文件为 .env 并填写实际值
# ============================================
# 安全配置 (必填)
# ============================================
# JWT 密钥 - 用于生成和验证 Token
# 生成方式: openssl rand -hex 32
SECRET_KEY=your-secret-key-here-change-in-production-use-openssl-rand-hex-32
# 数据加密密钥 - 用于敏感数据加密
# 生成方式: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
ENCRYPTION_KEY=
# ============================================
# 数据库配置 (PostgreSQL)
# ============================================
DB_NAME=tjwater
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=password
# ============================================
# InfluxDB 配置 (时序数据)
# ============================================
INFLUXDB_URL=http://localhost:8086
INFLUXDB_TOKEN=your-influxdb-token
INFLUXDB_ORG=your-org
INFLUXDB_BUCKET=tjwater
# ============================================
# JWT 配置 (可选)
# ============================================
# ACCESS_TOKEN_EXPIRE_MINUTES=30
# REFRESH_TOKEN_EXPIRE_DAYS=7
# ALGORITHM=HS256
# ============================================
# 其他配置
# ============================================
# PROJECT_NAME=TJWater Server
# API_V1_STR=/api/v1