Fix access to MinIO server with TLS (#1458)

fix: minIO的Region修改为非必要配置项
pull/1469/head
WangYa 2021-08-18 21:47:43 +08:00 committed by GitHub
parent 6a0527bb3d
commit 8953a06b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -51,7 +51,7 @@ public class MinioFileHandler implements FileHandler {
String source = String source =
optionService.getByPropertyOrDefault(MinioProperties.SOURCE, String.class, ""); optionService.getByPropertyOrDefault(MinioProperties.SOURCE, String.class, "");
String region = String region =
optionService.getByPropertyOfNonNull(MinioProperties.REGION).toString(); optionService.getByPropertyOrDefault(MinioProperties.REGION, String.class, "us-east-1");
endpoint = StringUtils.appendIfMissing(endpoint, HaloConst.URL_SEPARATOR); endpoint = StringUtils.appendIfMissing(endpoint, HaloConst.URL_SEPARATOR);
@ -78,6 +78,7 @@ public class MinioFileHandler implements FileHandler {
.stream(file.getInputStream(), file.getSize(), -1) .stream(file.getInputStream(), file.getSize(), -1)
.object(upFilePath) .object(upFilePath)
.build(); .build();
minioClient.ignoreCertCheck();
minioClient.putObject(putObjectArgs); minioClient.putObject(putObjectArgs);
UploadResult uploadResult = new UploadResult(); UploadResult uploadResult = new UploadResult();
@ -114,7 +115,7 @@ public class MinioFileHandler implements FileHandler {
String bucketName = String bucketName =
optionService.getByPropertyOfNonNull(MinioProperties.BUCKET_NAME).toString(); optionService.getByPropertyOfNonNull(MinioProperties.BUCKET_NAME).toString();
String region = String region =
optionService.getByPropertyOfNonNull(MinioProperties.REGION).toString(); optionService.getByPropertyOrDefault(MinioProperties.REGION, String.class, "us-east-1");
MinioClient minioClient = MinioClient.builder() MinioClient minioClient = MinioClient.builder()
.endpoint(endPoint) .endpoint(endPoint)
@ -123,6 +124,7 @@ public class MinioFileHandler implements FileHandler {
.build(); .build();
try { try {
minioClient.ignoreCertCheck();
minioClient.removeObject(RemoveObjectArgs.builder() minioClient.removeObject(RemoveObjectArgs.builder()
.bucket(bucketName) .bucket(bucketName)
.object(key) .object(key)

View File

@ -36,7 +36,7 @@ public enum MinioProperties implements PropertyEnum {
/** /**
* Minio regoin * Minio regoin
*/ */
REGION("minio_region", String.class, ""); REGION("minio_region", String.class, "us-east-1");
private final String value; private final String value;