diff --git a/pom.xml b/pom.xml index b57155f..e4c1916 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,12 @@ 2.0.51 + + io.minio + minio + 8.5.13 + + @@ -79,6 +85,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 9 + 9 + + diff --git a/src/main/java/top/yuchat/crawler/video/config/MinioConfig.java b/src/main/java/top/yuchat/crawler/video/config/MinioConfig.java new file mode 100644 index 0000000..0a76627 --- /dev/null +++ b/src/main/java/top/yuchat/crawler/video/config/MinioConfig.java @@ -0,0 +1,22 @@ +package top.yuchat.crawler.video.config; + +import io.minio.MinioClient; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@RequiredArgsConstructor +public class MinioConfig { + + private final MinioProperties minioProperties; + + @Bean + public MinioClient minioClient() { + return MinioClient.builder() + .endpoint(minioProperties.getEndpoint()) + .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey()) + .build(); + } + +} diff --git a/src/main/java/top/yuchat/crawler/video/config/MinioProperties.java b/src/main/java/top/yuchat/crawler/video/config/MinioProperties.java new file mode 100644 index 0000000..9c99339 --- /dev/null +++ b/src/main/java/top/yuchat/crawler/video/config/MinioProperties.java @@ -0,0 +1,31 @@ +package top.yuchat.crawler.video.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "minio") +public class MinioProperties { + + /** + * 访问地址 + */ + private String endpoint; + + /** + * 访问秘钥 + */ + private String accessKey; + + /** + * 秘钥密码 + */ + private String secretKey; + + /** + * 数据桶 + */ + private String bucket; +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d68bc1f..ec82143 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -5,7 +5,8 @@ spring: username: postgres password: longqi@1314 -top: - yuchat: - download: - path: F:\videos \ No newline at end of file +minio: + endpoint: http://10.101.83.84:9000 + access-key: CGG6QZHvKI0JEuXM5gBJ + secret-key: QXosu8wFLEjVMTdQ63mxmdYVJ1SFwbsGarXtkJxR + bucket: yuchat-video diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index ebe0af8..4e46808 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -5,6 +5,11 @@ spring: url: jdbc:postgresql://yuchat-databases:5432/postgres username: postgres password: longqi@1314 +minio: + endpoint: http://minio.yuchat:9000 + access-key: CGG6QZHvKI0JEuXM5gBJ + secret-key: QXosu8wFLEjVMTdQ63mxmdYVJ1SFwbsGarXtkJxR + bucket: yuchat-video # 日志级别,生产环境改为warn logging: