Files
yunrui_asset/backend/.env.example
T

109 lines
2.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IDC设备管理系统 - 环境配置
# 生成时间: 2026-02-26T05:07:19.876Z
# ==============================================
# 服务器配置
# ==============================================
# 服务器端口
PORT=8000
# 运行环境: development 或 production
NODE_ENV=development
# ==============================================
# 数据库配置
# ==============================================
# 数据库类型: sqlite 或 mysql
DB_TYPE=sqlite
# SQLite 配置(当 DB_TYPE=sqlite 时使用)
DB_PATH=./idc_management.db
# MySQL 配置(当 DB_TYPE=mysql 时使用)
# 注意:使用 MySQL 前请确保 MySQL 服务已安装并创建相应的数据库
# 数据库创建命令:CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USERNAME=root
MYSQL_PASSWORD=
MYSQL_DATABASE=idc_management
# ==============================================
# 安全配置
# ==============================================
# JWT 密钥 - 用于签名和验证用户身份令牌
# 开发环境留空会自动生成并保存到 .env 文件
# 生产环境必须设置强随机密钥(至少32位)
# 生成命令(PowerShell):-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 64 | ForEach-Object { [char]$_ })
# 生成命令(Node.js):require('crypto').randomBytes(64).toString('hex')
JWT_SECRET=
# Token 过期时间(格式:数字+单位,如 24h, 2h, 30m
TOKEN_EXPIRY=24h
# 密码加密强度(bcrypt salt rounds,范围:4-12
SALT_ROUNDS=12
# 登录失败锁定阈值
MAX_LOGIN_ATTEMPTS=3
# 账户锁定时间(分钟)
LOCK_TIME_MINUTES=15
# 密码最小长度
PASSWORD_MIN_LENGTH=8
# 用户名长度限制
USERNAME_MIN_LENGTH=4
USERNAME_MAX_LENGTH=30
# ==============================================
# API 配置
# ==============================================
# API 请求超时时间(毫秒)
API_TIMEOUT=20000
# 数据库查询超时时间(毫秒)
DB_QUERY_TIMEOUT=15000
# ==============================================
# 分页配置
# ==============================================
# 默认每页条数
DEFAULT_PAGE_SIZE=20
# 最大每页条数
MAX_PAGE_SIZE=500
# ==============================================
# 文件上传配置
# ==============================================
# 最大文件上传大小(MB
MAX_FILE_SIZE_MB=30
# 最大头像上传大小(MB
MAX_AVATAR_SIZE_MB=2
# ==============================================
# 重试配置
# ==============================================
# 最大重试次数
MAX_RETRIES=5
# 重试延迟(毫秒)
RETRY_DELAY=2000
# ==============================================
# 前端配置
# ==============================================
# 前端默认端口
FRONTEND_PORT=3000