KV存储改为默认开启

保存

保存
This commit is contained in:
eoao
2025-12-31 23:33:52 +08:00
parent 69632c8cc6
commit 88a4b9dff5
16 changed files with 75 additions and 80 deletions

View File

@@ -5,20 +5,20 @@ import { settingConst } from '../const/entity-const';
const r2Service = {
async hasOSS(c) {
async storageType(c) {
const setting = await settingService.query(c);
const { kvStorage, bucket, endpoint, s3AccessKey, s3SecretKey } = setting;
const { bucket, endpoint, s3AccessKey, s3SecretKey } = setting;
if (kvStorage === settingConst.kvStorage.OPEN) {
return true;
if (!!(bucket && endpoint && s3AccessKey && s3SecretKey)) {
return 'S3';
}
if (c.env.r2) {
return true;
return 'R2';
}
return !!(bucket && endpoint && s3AccessKey && s3SecretKey);
return 'KV';
},
async putObj(c, key, content, metadata) {