This commit is contained in:
luke 2025-06-21 01:00:54 +08:00
parent 1380115e72
commit 31da1625f5
2 changed files with 3 additions and 7 deletions

View File

@ -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;

View File

@ -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