You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.8 KiB
101 lines
2.8 KiB
|
3 months ago
|
# 微信小程序服务器环境变量配置示例(MySQL版本)
|
||
|
|
# 将此文件复制为 .env 文件并填写实际值
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# 微信小程序配置
|
||
|
|
# ========================================================
|
||
|
|
# 从微信公众平台获取的AppID
|
||
|
|
WECHAT_APPID=wx1234567890abcdef
|
||
|
|
|
||
|
|
# 从微信公众平台获取的AppSecret(请妥善保管,不要泄露)
|
||
|
|
WECHAT_APPSECRET=abcdef1234567890abcdef1234567890
|
||
|
|
|
||
|
|
# 微信消息校验Token(可选,用于消息验证)
|
||
|
|
WECHAT_TOKEN=your-random-token
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# MySQL数据库配置
|
||
|
|
# ========================================================
|
||
|
|
# MySQL主机地址(云数据库地址)
|
||
|
|
DB_HOST=your_mysql_host
|
||
|
|
|
||
|
|
# MySQL端口(默认3306)
|
||
|
|
DB_PORT=3306
|
||
|
|
|
||
|
|
# MySQL数据库名(主数据库)
|
||
|
|
DB_DATABASE=wechat_app
|
||
|
|
|
||
|
|
# MySQL用户名
|
||
|
|
DB_USER=your_mysql_username
|
||
|
|
|
||
|
|
# MySQL密码
|
||
|
|
DB_PASSWORD=your_mysql_password
|
||
|
|
|
||
|
|
# userlogin数据库名(如果需要连接)
|
||
|
|
DB_DATABASE_USERLOGIN=userlogin
|
||
|
|
|
||
|
|
# MySQL连接池配置
|
||
|
|
DB_MAX_CONNECTIONS=10
|
||
|
|
DB_MIN_CONNECTIONS=0
|
||
|
|
DB_CONNECTION_ACQUIRE_TIMEOUT=30000
|
||
|
|
DB_CONNECTION_IDLE_TIMEOUT=10000
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# 服务器配置
|
||
|
|
# ========================================================
|
||
|
|
# 服务器监听端口
|
||
|
|
PORT=3000
|
||
|
|
|
||
|
|
# 运行环境(development/production/test)
|
||
|
|
NODE_ENV=development
|
||
|
|
|
||
|
|
# 日志级别(debug/info/warn/error)
|
||
|
|
LOG_LEVEL=info
|
||
|
|
|
||
|
|
# 允许的跨域来源(多个来源用逗号分隔)
|
||
|
|
CORS_ORIGINS=https://your-miniprogram-domain.com,http://localhost:8080
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# 安全配置
|
||
|
|
# ========================================================
|
||
|
|
# JWT密钥(用于API认证,生成随机字符串)
|
||
|
|
JWT_SECRET=your-random-jwt-secret
|
||
|
|
|
||
|
|
# JWT过期时间(秒)
|
||
|
|
JWT_EXPIRES_IN=86400
|
||
|
|
|
||
|
|
# 加密密钥(用于敏感数据加密)
|
||
|
|
ENCRYPTION_KEY=your-encryption-key-32-bytes-length
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# 微信接口配置
|
||
|
|
# ========================================================
|
||
|
|
# 微信API基础URL
|
||
|
|
WECHAT_API_BASE_URL=https://api.weixin.qq.com
|
||
|
|
|
||
|
|
# 微信登录接口路径
|
||
|
|
WECHAT_LOGIN_PATH=/sns/jscode2session
|
||
|
|
|
||
|
|
# 微信接口请求超时时间(毫秒)
|
||
|
|
WECHAT_API_TIMEOUT=5000
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# 开发环境配置
|
||
|
|
# ========================================================
|
||
|
|
# 在开发环境中启用详细错误信息
|
||
|
|
DEVELOPMENT_SHOW_ERROR_DETAILS=true
|
||
|
|
|
||
|
|
# 是否启用请求日志记录
|
||
|
|
ENABLE_REQUEST_LOGGING=true
|
||
|
|
|
||
|
|
# ========================================================
|
||
|
|
# 生产环境配置
|
||
|
|
# ========================================================
|
||
|
|
# 是否启用Gzip压缩
|
||
|
|
PRODUCTION_ENABLE_GZIP=true
|
||
|
|
|
||
|
|
# 是否启用缓存
|
||
|
|
PRODUCTION_ENABLE_CACHE=true
|
||
|
|
|
||
|
|
# 缓存过期时间(秒)
|
||
|
|
PRODUCTION_CACHE_TTL=3600
|