| | |
| | | package com.ruoyi.oss.service.impl; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.oss.constant.OssConstant; |
| | | import com.ruoyi.oss.entity.UploadResult; |
| | | import com.ruoyi.oss.enumd.OssEnumd; |
| | | import com.ruoyi.oss.enumd.PolicyType; |
| | |
| | | super.init(ossProperties); |
| | | try { |
| | | minioClient = MinioClient.builder() |
| | | .endpoint(properties.getEndpoint()) |
| | | .endpoint(properties.getEndpoint(), 443, OssConstant.IS_HTTPS.equals(ossProperties.getIsHttps())) |
| | | .credentials(properties.getAccessKey(), properties.getSecretKey()) |
| | | .build(); |
| | | createBucket(); |
| | |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请核对Minio配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); |
| | | return UploadResult.builder().url(getEndpointLink() + "/" + path).filename(path).build(); |
| | | } |
| | | |
| | | @Override |