From 56d6291b67c3a6042e0996cf998689cf52c5e34e Mon Sep 17 00:00:00 2001 From: RhenCloud Date: Sun, 9 Nov 2025 22:26:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AF=B9=20Microsoft?= =?UTF-8?q?=20Onedrive=20=E5=82=A8=E5=AD=98=E6=94=AF=E6=8C=81=E7=9A=84=20T?= =?UTF-8?q?ODO=20=E9=A1=B9=E7=9B=AE=20refactor:=20=E4=BC=98=E5=8C=96=20STO?= =?UTF-8?q?RAGE=5FTYPE=20=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + storages/factory.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e18dc52..2408757 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ - [x] Github Repo 储存支持 - [ ] Github Release 储存支持 +- [ ] Microsoft Onedrive 储存支持 - [ ] 基于数据库的用户/权限管理 - [ ] 操作日志记录 - [ ] Office Documents 预览支持 diff --git a/storages/factory.py b/storages/factory.py index b992859..eef33d5 100644 --- a/storages/factory.py +++ b/storages/factory.py @@ -29,9 +29,15 @@ class StorageFactory: if cls._instance is not None: return cls._instance - storage_type = os.getenv( - "STORAGE_TYPE", - ).lower() + storage_type = os.getenv("STORAGE_TYPE") + + if not storage_type: + raise RuntimeError( + "STORAGE_TYPE environment variable is not set. " + "Supported types: r2, github" + ) + + storage_type = storage_type.lower() if storage_type == "r2": cls._instance = R2Storage()