| | |
| | | package com.gkhy.safePlatform.minioFile.config; |
| | | |
| | | import io.minio.MinioClient; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @ConfigurationProperties(prefix = "minio") |
| | | public class MinioConfig { |
| | | |
| | | private String endpoint; |
| | | |
| | | private int port; |
| | | |
| | | private String accessKey; |
| | | |
| | | private String secretKey; |
| | | |
| | | private Boolean secure; |
| | | |
| | | private String bucketName; |
| | | |
| | | private String urlPrefix; |
| | | |
| | | @Bean |
| | | public MinioClient getMinioClient(){ |
| | | String endpointUrl = "http://"+endpoint+":"+port; |
| | | MinioClient minioClient = MinioClient.builder().endpoint(endpointUrl) |
| | | .credentials(accessKey,secretKey) |
| | | .build(); |
| | | return minioClient; |
| | | } |
| | | |
| | | public String getEndpoint() { |
| | | return endpoint; |
| | | } |
| | | |
| | | public void setEndpoint(String endpoint) { |
| | | this.endpoint = endpoint; |
| | | } |
| | | |
| | | public int getPort() { |
| | | return port; |
| | | } |
| | | |
| | | public void setPort(int port) { |
| | | this.port = port; |
| | | } |
| | | |
| | | public String getAccessKey() { |
| | | return accessKey; |
| | | } |
| | | |
| | | public void setAccessKey(String accessKey) { |
| | | this.accessKey = accessKey; |
| | | } |
| | | |
| | | public String getSecretKey() { |
| | | return secretKey; |
| | | } |
| | | |
| | | public void setSecretKey(String secretKey) { |
| | | this.secretKey = secretKey; |
| | | } |
| | | |
| | | public Boolean getSecure() { |
| | | return secure; |
| | | } |
| | | |
| | | public void setSecure(Boolean secure) { |
| | | this.secure = secure; |
| | | } |
| | | |
| | | public String getBucketName() { |
| | | return bucketName; |
| | | } |
| | | |
| | | public void setBucketName(String bucketName) { |
| | | this.bucketName = bucketName; |
| | | } |
| | | |
| | | public String getUrlPrefix() { |
| | | return urlPrefix; |
| | | } |
| | | |
| | | public void setUrlPrefix(String urlPrefix) { |
| | | this.urlPrefix = urlPrefix; |
| | | } |
| | | } |
| | | //package com.gkhy.safePlatform.minioFile.config; |
| | | // |
| | | //import io.minio.MinioClient; |
| | | //import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | //import org.springframework.context.annotation.Bean; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //@Component |
| | | //@ConfigurationProperties(prefix = "minio") |
| | | //public class MinioConfig { |
| | | // |
| | | // private String endpoint; |
| | | // |
| | | // private int port; |
| | | // |
| | | // private String accessKey; |
| | | // |
| | | // private String secretKey; |
| | | // |
| | | // private Boolean secure; |
| | | // |
| | | // private String bucketName; |
| | | // |
| | | // private String urlPrefix; |
| | | // |
| | | // @Bean |
| | | // public MinioClient getMinioClient(){ |
| | | // String endpointUrl = "http://"+endpoint+":"+port; |
| | | // MinioClient minioClient = MinioClient.builder().endpoint(endpointUrl) |
| | | // .credentials(accessKey,secretKey) |
| | | // .build(); |
| | | // return minioClient; |
| | | // } |
| | | // |
| | | // public String getEndpoint() { |
| | | // return endpoint; |
| | | // } |
| | | // |
| | | // public void setEndpoint(String endpoint) { |
| | | // this.endpoint = endpoint; |
| | | // } |
| | | // |
| | | // public int getPort() { |
| | | // return port; |
| | | // } |
| | | // |
| | | // public void setPort(int port) { |
| | | // this.port = port; |
| | | // } |
| | | // |
| | | // public String getAccessKey() { |
| | | // return accessKey; |
| | | // } |
| | | // |
| | | // public void setAccessKey(String accessKey) { |
| | | // this.accessKey = accessKey; |
| | | // } |
| | | // |
| | | // public String getSecretKey() { |
| | | // return secretKey; |
| | | // } |
| | | // |
| | | // public void setSecretKey(String secretKey) { |
| | | // this.secretKey = secretKey; |
| | | // } |
| | | // |
| | | // public Boolean getSecure() { |
| | | // return secure; |
| | | // } |
| | | // |
| | | // public void setSecure(Boolean secure) { |
| | | // this.secure = secure; |
| | | // } |
| | | // |
| | | // public String getBucketName() { |
| | | // return bucketName; |
| | | // } |
| | | // |
| | | // public void setBucketName(String bucketName) { |
| | | // this.bucketName = bucketName; |
| | | // } |
| | | // |
| | | // public String getUrlPrefix() { |
| | | // return urlPrefix; |
| | | // } |
| | | // |
| | | // public void setUrlPrefix(String urlPrefix) { |
| | | // this.urlPrefix = urlPrefix; |
| | | // } |
| | | //} |