feat(storage): integrate Alibaba Cloud OSS for file persistence - Add OSSAdapter and LocalAdapter with StorageFactory pattern - Integrate PKB module with OSS upload - Rename difyDocumentId to storageKey - Create 4 OSS buckets and development specification
This commit is contained in:
79
backend/env.example.md
Normal file
79
backend/env.example.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# 环境变量配置示例
|
||||
|
||||
复制以下内容到 `.env` 文件中:
|
||||
|
||||
```bash
|
||||
# ===========================================
|
||||
# AI Clinical Research Platform - 环境变量配置
|
||||
# ===========================================
|
||||
|
||||
# ==================== 应用配置 ====================
|
||||
NODE_ENV=development
|
||||
PORT=3001
|
||||
HOST=0.0.0.0
|
||||
LOG_LEVEL=debug
|
||||
SERVICE_NAME=aiclinical-backend
|
||||
|
||||
# ==================== 数据库配置 ====================
|
||||
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ai_clinical
|
||||
|
||||
# ==================== 存储配置 ====================
|
||||
# 存储类型:local | oss
|
||||
STORAGE_TYPE=local
|
||||
|
||||
# --- 本地存储配置(STORAGE_TYPE=local)---
|
||||
LOCAL_STORAGE_DIR=uploads
|
||||
LOCAL_STORAGE_URL=http://localhost:3001/uploads
|
||||
|
||||
# --- 阿里云OSS配置(STORAGE_TYPE=oss)---
|
||||
# OSS_REGION=oss-cn-beijing
|
||||
# OSS_BUCKET=ai-clinical-data-dev
|
||||
# OSS_BUCKET_STATIC=ai-clinical-static-dev
|
||||
# OSS_ACCESS_KEY_ID=your-access-key-id
|
||||
# OSS_ACCESS_KEY_SECRET=your-access-key-secret
|
||||
# OSS_INTERNAL=false
|
||||
# OSS_SIGNED_URL_EXPIRES=3600
|
||||
|
||||
# ==================== 安全配置 ====================
|
||||
JWT_SECRET=your-secret-key-change-in-production
|
||||
JWT_EXPIRES_IN=7d
|
||||
CORS_ORIGIN=http://localhost:5173
|
||||
|
||||
# ==================== LLM API配置 ====================
|
||||
DEEPSEEK_API_KEY=
|
||||
DEEPSEEK_BASE_URL=https://api.deepseek.com
|
||||
DASHSCOPE_API_KEY=
|
||||
GEMINI_API_KEY=
|
||||
|
||||
# ==================== 文件上传配置 ====================
|
||||
UPLOAD_MAX_SIZE=31457280
|
||||
```
|
||||
|
||||
## OSS 开发环境配置
|
||||
|
||||
如果要测试 OSS,将 `STORAGE_TYPE` 改为 `oss` 并填写以下配置:
|
||||
|
||||
```bash
|
||||
STORAGE_TYPE=oss
|
||||
OSS_REGION=oss-cn-beijing
|
||||
OSS_BUCKET=ai-clinical-data-dev
|
||||
OSS_BUCKET_STATIC=ai-clinical-static-dev
|
||||
OSS_ACCESS_KEY_ID=LTAI5tBHkL39GjdLfcr77Y3f
|
||||
OSS_ACCESS_KEY_SECRET=<从安全渠道获取>
|
||||
OSS_INTERNAL=false
|
||||
OSS_SIGNED_URL_EXPIRES=3600
|
||||
```
|
||||
|
||||
## OSS 生产环境配置(SAE)
|
||||
|
||||
```bash
|
||||
STORAGE_TYPE=oss
|
||||
OSS_REGION=oss-cn-beijing
|
||||
OSS_BUCKET=ai-clinical-data
|
||||
OSS_BUCKET_STATIC=ai-clinical-static
|
||||
OSS_ACCESS_KEY_ID=LTAI5tBHkL39GjdLfcr77Y3f
|
||||
OSS_ACCESS_KEY_SECRET=<从安全渠道获取>
|
||||
OSS_INTERNAL=true # 🔴 生产必须用内网
|
||||
OSS_SIGNED_URL_EXPIRES=3600
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user