fastapi-demo/.env.example

72 lines
1.8 KiB
Plaintext
Raw Permalink 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.

# FastAPI 演示项目环境配置模板
# 复制此文件为 .env 并根据实际情况修改配置
# === 应用基础配置 ===
PROJECT_NAME=FastAPI Demo
VERSION=1.0.0
DEBUG=True
ENVIRONMENT=development
# === 服务器配置 ===
HOST=0.0.0.0
PORT=8000
LOG_LEVEL=info
# WORKERS=1 # 生产环境可设置多个 worker
# RELOAD=True # 开发环境开启热重载
# === MySQL 数据库配置 ===
# 请根据实际环境修改数据库连接信息
DB_HOST=localhost
DB_PORT=3306
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_database_name
DB_CHARSET=utf8mb4
# === 数据库连接池配置 ===
DB_ECHO=False # 开启后会打印 SQL 语句,调试时可设为 True
DB_POOL_SIZE=5
DB_MAX_OVERFLOW=10
DB_POOL_TIMEOUT=30
DB_POOL_RECYCLE=3600
# === Redis 配置(可选) ===
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
# REDIS_PASSWORD=your_redis_password
# === CORS 配置 ===
# 开发环境允许所有来源,生产环境应指定具体域名
CORS_ORIGINS=["*"]
# 生产环境示例CORS_ORIGINS=["https://yourdomain.com","https://api.yourdomain.com"]
# === JWT 配置 ===
# 生产环境必须使用强密钥至少32个字符
SECRET_KEY=your-secret-key-here-change-in-production
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7
# === API 文档配置 ===
# 生产环境建议关闭 API 文档
# DOCS_URL=/docs
# REDOC_URL=/redoc
# 关闭文档示例:
# DOCS_URL=
# REDOC_URL=
# === 邮件配置(可选) ===
# SMTP_HOST=smtp.yourdomain.com
# SMTP_PORT=587
# SMTP_USER=noreply@yourdomain.com
# SMTP_PASSWORD=your_smtp_password
# SMTP_FROM=noreply@yourdomain.com
# === 监控配置(可选) ===
# SENTRY_DSN=https://your-sentry-dsn@sentry.io/project-id
# PROMETHEUS_ENABLED=True
# === 限流配置(可选) ===
# RATE_LIMIT_ENABLED=True
# RATE_LIMIT_REQUESTS=100
# RATE_LIMIT_PERIOD=60