mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
【功能优化】全局:文件存储 S3 兼容腾讯云、火山云的 VirtualStyle 模式
This commit is contained in:
parent
d9b913a7dd
commit
4386c7018c
@ -37,6 +37,7 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> {
|
||||
.region(buildRegion()) // Region
|
||||
.credentials(config.getAccessKey(), config.getAccessSecret()) // 认证密钥
|
||||
.build();
|
||||
enableVirtualStyleEndpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,6 +87,17 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启 VirtualStyle 模式
|
||||
*/
|
||||
private void enableVirtualStyleEndpoint() {
|
||||
if (StrUtil.containsAll(config.getEndpoint(),
|
||||
S3FileClientConfig.ENDPOINT_TENCENT, // 腾讯云 https://cloud.tencent.com/document/product/436/41284
|
||||
S3FileClientConfig.ENDPOINT_VOLCES)) { // 火山云 https://www.volcengine.com/docs/6349/1288493
|
||||
client.enableVirtualStyleEndpoint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] content, String path, String type) throws Exception {
|
||||
// 执行上传
|
||||
|
@ -20,6 +20,7 @@ public class S3FileClientConfig implements FileClientConfig {
|
||||
public static final String ENDPOINT_QINIU = "qiniucs.com";
|
||||
public static final String ENDPOINT_ALIYUN = "aliyuncs.com";
|
||||
public static final String ENDPOINT_TENCENT = "myqcloud.com";
|
||||
public static final String ENDPOINT_VOLCES = "volces.com"; // 火山云(字节)
|
||||
|
||||
/**
|
||||
* 节点地址
|
||||
|
Loading…
Reference in New Issue
Block a user