Skip to content

Commit

Permalink
Fix access to MinIO server with TLS (#1458)
Browse files Browse the repository at this point in the history
fix: minIO的Region修改为非必要配置项
  • Loading branch information
secondarycoder authored Aug 18, 2021
1 parent 6a0527b commit 8953a06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main/java/run/halo/app/handler/file/MinioFileHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public UploadResult upload(@NonNull MultipartFile file) {
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);

Expand All @@ -78,6 +78,7 @@ public UploadResult upload(@NonNull MultipartFile file) {
.stream(file.getInputStream(), file.getSize(), -1)
.object(upFilePath)
.build();
minioClient.ignoreCertCheck();
minioClient.putObject(putObjectArgs);

UploadResult uploadResult = new UploadResult();
Expand Down Expand Up @@ -114,7 +115,7 @@ public void delete(@NonNull String key) {
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)
Expand All @@ -123,6 +124,7 @@ public void delete(@NonNull String key) {
.build();

try {
minioClient.ignoreCertCheck();
minioClient.removeObject(RemoveObjectArgs.builder()
.bucket(bucketName)
.object(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

1 comment on commit 8953a06

@chivehao
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

37行我当初手滑,打错了顺序,2333

Please sign in to comment.