主要修改: - 移除 postgres:15-alpine 和 redis 容器依赖 - 优化 docker-compose.yml 配置,使用 host 网络模式 - 移除 CI/CD 中的自动数据库迁移,改为手动执行 - 更新环境变量配置,连接到现有的 PostgreSQL 和 Redis 服务 - 完善部署文档,增加现有服务集成说明 配置优化: - 修正 docker-compose.yml 位置到 backend 目录 - 简化 CI/CD 测试流程,跳过需要数据库的测试 - 增加数据库迁移安全策略说明 - 完善部署流程文档和故障排除指南
84 lines
2.0 KiB
Plaintext
84 lines
2.0 KiB
Plaintext
# 摄影作品集项目环境变量配置
|
|
|
|
# ================================
|
|
# 数据库配置 (连接到现有的 PostgreSQL 服务)
|
|
# ================================
|
|
DB_HOST=localhost
|
|
DB_PORT=5432
|
|
DB_NAME=photography
|
|
DB_USER=postgres
|
|
DB_PASSWORD=your_existing_postgres_password
|
|
|
|
# ================================
|
|
# Redis 配置 (连接到现有的 Redis 服务)
|
|
# ================================
|
|
REDIS_HOST=localhost
|
|
REDIS_PORT=6379
|
|
REDIS_PASSWORD=your_existing_redis_password
|
|
|
|
# ================================
|
|
# JWT 认证配置
|
|
# ================================
|
|
JWT_SECRET=your_jwt_secret_key_here_at_least_32_characters
|
|
JWT_EXPIRES_IN=24h
|
|
|
|
# ================================
|
|
# 服务器配置
|
|
# ================================
|
|
PORT=8080
|
|
GIN_MODE=release
|
|
CORS_ORIGINS=https://photography.iriver.top,https://admin.photography.iriver.top
|
|
|
|
# ================================
|
|
# 文件存储配置
|
|
# ================================
|
|
STORAGE_TYPE=local
|
|
STORAGE_PATH=/app/uploads
|
|
MAX_UPLOAD_SIZE=10MB
|
|
|
|
# AWS S3 配置 (如果使用 S3 存储)
|
|
# AWS_REGION=us-east-1
|
|
# AWS_BUCKET=photography-bucket
|
|
# AWS_ACCESS_KEY_ID=your_access_key
|
|
# AWS_SECRET_ACCESS_KEY=your_secret_key
|
|
|
|
# ================================
|
|
# 日志配置
|
|
# ================================
|
|
LOG_LEVEL=info
|
|
LOG_FORMAT=json
|
|
|
|
# ================================
|
|
# 邮件配置 (用于通知)
|
|
# ================================
|
|
SMTP_HOST=smtp.gmail.com
|
|
SMTP_PORT=587
|
|
SMTP_USER=your_email@gmail.com
|
|
SMTP_PASSWORD=your_app_password
|
|
SMTP_FROM=noreply@photography.iriver.top
|
|
|
|
# ================================
|
|
# 监控配置
|
|
# ================================
|
|
ENABLE_METRICS=true
|
|
METRICS_PORT=9090
|
|
|
|
# ================================
|
|
# 安全配置
|
|
# ================================
|
|
RATE_LIMIT=100
|
|
RATE_LIMIT_WINDOW=1h
|
|
ENABLE_CSRF=true
|
|
CSRF_SECRET=your_csrf_secret_here
|
|
|
|
# ================================
|
|
# 缓存配置
|
|
# ================================
|
|
CACHE_TTL=3600
|
|
ENABLE_CACHE=true
|
|
|
|
# ================================
|
|
# 部署配置
|
|
# ================================
|
|
ENVIRONMENT=production
|
|
TZ=Asia/Shanghai |