mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-11-11 11:43:45 +08:00
update 增加OSS模块service自动激活
This commit is contained in:
@@ -32,11 +32,15 @@ public class AliyunCloudStorageServiceImpl extends AbstractCloudStorageService i
|
||||
@Autowired
|
||||
public AliyunCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||
this.properties = properties.getAliyun();
|
||||
ClientConfiguration configuration = new ClientConfiguration();
|
||||
DefaultCredentialProvider credentialProvider = new DefaultCredentialProvider(
|
||||
this.properties.getAccessKeyId(),
|
||||
this.properties.getAccessKeySecret());
|
||||
client = new OSSClient(this.properties.getEndpoint(), credentialProvider, configuration);
|
||||
try {
|
||||
ClientConfiguration configuration = new ClientConfiguration();
|
||||
DefaultCredentialProvider credentialProvider = new DefaultCredentialProvider(
|
||||
this.properties.getAccessKeyId(),
|
||||
this.properties.getAccessKeySecret());
|
||||
client = new OSSClient(this.properties.getEndpoint(), credentialProvider, configuration);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("阿里云存储配置错误! 请检查系统配置!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,10 +29,14 @@ public class MinioCloudStorageServiceImpl extends AbstractCloudStorageService im
|
||||
@Autowired
|
||||
public MinioCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||
this.properties = properties.getMinio();
|
||||
minioClient = MinioClient.builder()
|
||||
.endpoint(this.properties.getEndpoint())
|
||||
.credentials(this.properties.getAccessKey(), this.properties.getSecretKey())
|
||||
.build();
|
||||
try {
|
||||
minioClient = MinioClient.builder()
|
||||
.endpoint(this.properties.getEndpoint())
|
||||
.credentials(this.properties.getAccessKey(), this.properties.getSecretKey())
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Minio存储配置错误! 请检查系统配置!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,14 +32,18 @@ public class QcloudCloudStorageServiceImpl extends AbstractCloudStorageService i
|
||||
@Autowired
|
||||
public QcloudCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||
this.properties = properties.getQcloud();
|
||||
COSCredentials credentials = new BasicCOSCredentials(
|
||||
this.properties.getSecretId(),
|
||||
this.properties.getSecretKey());
|
||||
// 初始化客户端配置
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
// 设置bucket所在的区域,华南:gz 华北:tj 华东:sh
|
||||
clientConfig.setRegion(new Region(this.properties.getRegion()));
|
||||
client = new COSClient(credentials, clientConfig);
|
||||
try {
|
||||
COSCredentials credentials = new BasicCOSCredentials(
|
||||
this.properties.getSecretId(),
|
||||
this.properties.getSecretKey());
|
||||
// 初始化客户端配置
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
// 设置bucket所在的区域,华南:gz 华北:tj 华东:sh
|
||||
clientConfig.setRegion(new Region(this.properties.getRegion()));
|
||||
client = new COSClient(credentials, clientConfig);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("腾讯云存储配置错误! 请检查系统配置!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,16 +36,20 @@ public class QiniuCloudStorageServiceImpl extends AbstractCloudStorageService im
|
||||
@Autowired
|
||||
public QiniuCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||
this.properties = properties.getQiniu();
|
||||
// z0 z1 z2
|
||||
Configuration config = new Configuration(Region.autoRegion());
|
||||
// 默认不使用https
|
||||
config.useHttpsDomains = false;
|
||||
uploadManager = new UploadManager(config);
|
||||
Auth auth = Auth.create(
|
||||
this.properties.getAccessKey(),
|
||||
this.properties.getSecretKey());
|
||||
token = auth.uploadToken(this.properties.getBucketName());
|
||||
bucketManager = new BucketManager(auth, config);
|
||||
try {
|
||||
// z0 z1 z2
|
||||
Configuration config = new Configuration(Region.autoRegion());
|
||||
// 默认不使用https
|
||||
config.useHttpsDomains = false;
|
||||
uploadManager = new UploadManager(config);
|
||||
Auth auth = Auth.create(
|
||||
this.properties.getAccessKey(),
|
||||
this.properties.getSecretKey());
|
||||
token = auth.uploadToken(this.properties.getBucketName());
|
||||
bucketManager = new BucketManager(auth, config);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("七牛云存储配置错误! 请检查系统配置!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user