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

View File

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