fix: add region for operate minio attachment (halo-dev#1439) (#1440)

Co-authored-by: li-guohao <liguohao_cn@qq.com>
pull/1446/head
安静的阿豪 2021-07-25 14:01:31 +08:00 committed by GitHub
parent 84056cf9a0
commit 6a84483b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -50,12 +50,15 @@ public class MinioFileHandler implements FileHandler {
optionService.getByPropertyOfNonNull(MinioProperties.BUCKET_NAME).toString();
String source =
optionService.getByPropertyOrDefault(MinioProperties.SOURCE, String.class, "");
String region =
optionService.getByPropertyOfNonNull(MinioProperties.REGION).toString();
endpoint = StringUtils.appendIfMissing(endpoint, HaloConst.URL_SEPARATOR);
MinioClient minioClient = MinioClient.builder()
.endpoint(endpoint)
.credentials(accessKey, accessSecret)
.region(region)
.build();
try {
@ -110,10 +113,13 @@ public class MinioFileHandler implements FileHandler {
optionService.getByPropertyOfNonNull(MinioProperties.ACCESS_SECRET).toString();
String bucketName =
optionService.getByPropertyOfNonNull(MinioProperties.BUCKET_NAME).toString();
String region =
optionService.getByPropertyOfNonNull(MinioProperties.REGION).toString();
MinioClient minioClient = MinioClient.builder()
.endpoint(endPoint)
.credentials(accessKey, accessSecret)
.region(region)
.build();
try {

View File

@ -31,7 +31,12 @@ public enum MinioProperties implements PropertyEnum {
/**
* Minio source
*/
SOURCE("minio_source", String.class, "");
SOURCE("minio_source", String.class, ""),
/**
* Minio regoin
*/
REGION("minio_region", String.class, "");
private final String value;