diff --git a/src/main/java/com/knowledge/base/infrastructure/south/minio/MinioOSGatewayImpl.java b/src/main/java/com/knowledge/base/infrastructure/south/minio/MinioOSGatewayImpl.java index 13d3e2c..c83947e 100644 --- a/src/main/java/com/knowledge/base/infrastructure/south/minio/MinioOSGatewayImpl.java +++ b/src/main/java/com/knowledge/base/infrastructure/south/minio/MinioOSGatewayImpl.java @@ -12,6 +12,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; @Component @@ -24,9 +25,6 @@ public class MinioOSGatewayImpl implements ObjectStorageGateway { private final ObjectStorageProperties objectStorageProperties; - @Value("${local.minio.endpoint:http://localhost:19000}") - private String localMinioEndpoint; - public MinioOSGatewayImpl( @Value("${minio.endpoint:http://s3.wisdompulse.cn}") String endpoint, @Value("${minio.access-key:lukeye}") String accessKey, @@ -38,8 +36,9 @@ public class MinioOSGatewayImpl implements ObjectStorageGateway { .credentials(accessKey, secretKey) .build(); // 为了提升上传的速度,创建本地 minio 客户端 + String activeProfile = System.getProperty("spring.profiles.active", "docker"); this.localMinioClient = MinioClient.builder() - .endpoint(localMinioEndpoint) + .endpoint(Set.of("windows", "docker").contains(activeProfile) ? "http://localhost:9000" : "http://s3.wisdompulse.cn") .credentials(accessKey, secretKey) .build(); this.objectStorageProperties = objectStorageProperties; diff --git a/src/main/resources/application-dev-mac.properties b/src/main/resources/application-dev-mac.properties index d23d31e..9cae15f 100644 --- a/src/main/resources/application-dev-mac.properties +++ b/src/main/resources/application-dev-mac.properties @@ -41,6 +41,3 @@ mybatis-plus.global-config.db-config.id-type=auto # Redis 开关控制 knowledge.base.redis.enable=false - -# 对象存储相关 -local.minio.endpoint=http://s3.wisdompulse.cn \ No newline at end of file