use of com.zhouzifei.tool.config.QcloudFileProperties in project simpleFS by shengdingbox.
the class QCloudOssApiClient method init.
@Override
public QCloudOssApiClient init(FileProperties fileProperties) {
final QcloudFileProperties qcloudFileProperties = fileProperties.getTengxun();
String accessKey = qcloudFileProperties.getAccessKey();
String secretKey = qcloudFileProperties.getSecretKey();
String endpoint = qcloudFileProperties.getEndpoint();
String url = qcloudFileProperties.getUrl();
this.bucketName = qcloudFileProperties.getBucketName();
checkDomainUrl(url);
if (StringUtils.isNullOrEmpty(accessKey) || StringUtils.isNullOrEmpty(secretKey) || StringUtils.isNullOrEmpty(bucketName)) {
throw new ServiceException("[" + this.storageType + "]尚未配置腾讯云,文件上传功能暂时不可用!");
}
COSCredentials cred = new BasicCOSCredentials(accessKey, secretKey);
Region region = new Region(endpoint);
ClientConfig clientConfig = new ClientConfig(region);
cosClient = new COSClient(cred, clientConfig);
return this;
}
Aggregations