Skip to content

fix: fix config error#75

Merged
ZhengZhenyu merged 2 commits intoopensourceways:mainfrom
ZhengZhenyu:main
Feb 25, 2026
Merged

fix: fix config error#75
ZhengZhenyu merged 2 commits intoopensourceways:mainfrom
ZhengZhenyu:main

Conversation

@ZhengZhenyu
Copy link
Collaborator

变更说明

关联 Issue:#

Checklist

  • 功能实现正确,无明显 Bug
  • 测试通过(新增/修改功能已补充测试,覆盖率 ≥ 80%)
  • 无敏感信息硬编码(密钥、密码、Token)
  • 数据库有变更时迁移文件已生成并测试
  • 必要的文档已同步更新

存储层重构:
- 新增 StorageService 抽象基类,支持 LocalStorage(本地,开发默认)
  和 S3Storage(MinIO / AWS S3 / 华为 OBS 等,生产推荐)双后端
- upload.py 改用 StorageService,移除直接文件写入;markdown 内存解码,
  docx 使用 tempfile 临时解析后存入 StorageService
- main.py 改为条件挂载 StaticFiles(仅本地模式下生效)

基础设施:
- docker-compose.yml 新增 minio 服务(minio_data volume 持久化,
  9001 端口为控制台,backend 依赖 MinIO 健康检查)
- nginx.conf 将 /uploads/ 代理改为直连 minio:9000/opengecko/
  (开发时由 FastAPI StaticFiles 接管,无需 nginx)

配置管理:
- config.py 所有字段加 Field(description=...),配置说明写入代码本身
- 新增 GET /api/admin/config-schema 端点(仅 superuser 可访问),
  返回 Pydantic 自动生成的 JSON Schema 及当前生效值(密钥脱敏)
- 补充 .env.example 和 .env.prod.example 的 S3/MinIO 配置块

迁移工具:
- 新增 backend/scripts/migrate_to_minio.py,一键将本地 uploads/ 目录
  文件批量迁移至 MinIO,支持环境变量覆盖参数
@opensourceways-bot
Copy link
Contributor

CLA Signature Pass

ZhengZhenyu, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot
Copy link
Contributor

Linking Issue Notice

@ZhengZhenyu , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@ZhengZhenyu ZhengZhenyu merged commit 25242f9 into opensourceways:main Feb 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants