Search in sources :

Example 1 with QiniuFileProperties

use of com.zhouzifei.tool.config.QiniuFileProperties in project simpleFS by shengdingbox.

the class QiniuApiClient method init.

@Override
public QiniuApiClient init(FileProperties fileProperties) {
    final QiniuFileProperties qiniuFileProperties = fileProperties.getQiniu();
    String accessKey = qiniuFileProperties.getAccessKey();
    String secretKey = qiniuFileProperties.getSecretKey();
    this.bucket = qiniuFileProperties.getBucketName();
    String url = qiniuFileProperties.getUrl();
    checkDomainUrl(url);
    if (StringUtils.isNullOrEmpty(accessKey) || StringUtils.isNullOrEmpty(secretKey) || StringUtils.isNullOrEmpty(bucket)) {
        throw new ServiceException("[" + this.storageType + "]尚未配置七牛云,文件上传功能暂时不可用!");
    }
    auth = Auth.create(accessKey, secretKey);
    return this;
}
Also used : ServiceException(com.zhouzifei.tool.common.ServiceException) QiniuFileProperties(com.zhouzifei.tool.config.QiniuFileProperties)

Aggregations

ServiceException (com.zhouzifei.tool.common.ServiceException)1 QiniuFileProperties (com.zhouzifei.tool.config.QiniuFileProperties)1