You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
1.8 KiB
84 lines
1.8 KiB
package {{ package.Common }}.config;
|
|
import {{ package.Common }}.unit.MinioUpComponent;
|
|
|
|
|
|
import io.minio.MinioClient;
|
|
import lombok.Data;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.stereotype.Component;
|
|
import java.io.Serializable;
|
|
|
|
/**
|
|
* @Description: minio配置类
|
|
* @Author: {{author}}
|
|
* @Date: {{date}}
|
|
* @wechat: {{ wechat }}
|
|
*/
|
|
|
|
@Component
|
|
@Data
|
|
@ConditionalOnClass(MinioUpComponent.class)
|
|
public class MinioConfig implements Serializable {
|
|
|
|
|
|
/**
|
|
* API调用地址ip
|
|
*/
|
|
@Value("${minio.config.ip}")
|
|
private String ip;
|
|
|
|
/**
|
|
* API调用地址端口
|
|
*/
|
|
@Value("${minio.config.port}")
|
|
private String port;
|
|
|
|
/**
|
|
* 连接账号
|
|
*/
|
|
@Value("${minio.config.accessKey}")
|
|
private String accessKey;
|
|
|
|
/**
|
|
* 连接秘钥
|
|
*/
|
|
@Value("${minio.config.secretKey}")
|
|
private String secretKey;
|
|
|
|
/**
|
|
* minio存储桶的名称
|
|
*/
|
|
@Value("${minio.config.bucketName}")
|
|
private String bucketName;
|
|
|
|
/**
|
|
* 文件下载到本地的路径
|
|
*/
|
|
@Value("${minio.config.downloadDir}")
|
|
private String downloadDir;
|
|
|
|
/**
|
|
* #如果是true,则用的是https而不是http,默认值是true
|
|
*/
|
|
@Value("${minio.config.secure}")
|
|
private Boolean secure;
|
|
|
|
@Value("${minio.config.readPath}")
|
|
private String readPath;
|
|
|
|
@Value("${minio.config.endpoint}")
|
|
private String endpoint;
|
|
|
|
@Bean
|
|
public MinioClient buildClient() {
|
|
//1.创建minio链接客户端
|
|
return MinioClient
|
|
.builder()
|
|
.credentials(accessKey, secretKey)
|
|
.endpoint(endpoint)
|
|
.build();
|
|
}
|
|
|
|
}
|
|
|