|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+package com.ruoyi.file.config;
|
|
|
2
|
+
|
|
|
3
|
+import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
4
|
+import org.springframework.context.annotation.Bean;
|
|
|
5
|
+import org.springframework.context.annotation.Configuration;
|
|
|
6
|
+import io.minio.MinioClient;
|
|
|
7
|
+
|
|
|
8
|
+/**
|
|
|
9
|
+ * Minio 配置信息
|
|
|
10
|
+ *
|
|
|
11
|
+ * @author ruoiy
|
|
|
12
|
+ */
|
|
|
13
|
+@Configuration
|
|
|
14
|
+@ConfigurationProperties(prefix = "minio")
|
|
|
15
|
+public class MinioConfig
|
|
|
16
|
+{
|
|
|
17
|
+ /**
|
|
|
18
|
+ * 服务地址
|
|
|
19
|
+ */
|
|
|
20
|
+ private String url;
|
|
|
21
|
+
|
|
|
22
|
+ /**
|
|
|
23
|
+ * 用户名
|
|
|
24
|
+ */
|
|
|
25
|
+ private String accessKey;
|
|
|
26
|
+
|
|
|
27
|
+ /**
|
|
|
28
|
+ * 密码
|
|
|
29
|
+ */
|
|
|
30
|
+ private String secretKey;
|
|
|
31
|
+
|
|
|
32
|
+ /**
|
|
|
33
|
+ * 存储桶名称
|
|
|
34
|
+ */
|
|
|
35
|
+ private String bucketName;
|
|
|
36
|
+
|
|
|
37
|
+ public String getUrl()
|
|
|
38
|
+ {
|
|
|
39
|
+ return url;
|
|
|
40
|
+ }
|
|
|
41
|
+
|
|
|
42
|
+ public void setUrl(String url)
|
|
|
43
|
+ {
|
|
|
44
|
+ this.url = url;
|
|
|
45
|
+ }
|
|
|
46
|
+
|
|
|
47
|
+ public String getAccessKey()
|
|
|
48
|
+ {
|
|
|
49
|
+ return accessKey;
|
|
|
50
|
+ }
|
|
|
51
|
+
|
|
|
52
|
+ public void setAccessKey(String accessKey)
|
|
|
53
|
+ {
|
|
|
54
|
+ this.accessKey = accessKey;
|
|
|
55
|
+ }
|
|
|
56
|
+
|
|
|
57
|
+ public String getSecretKey()
|
|
|
58
|
+ {
|
|
|
59
|
+ return secretKey;
|
|
|
60
|
+ }
|
|
|
61
|
+
|
|
|
62
|
+ public void setSecretKey(String secretKey)
|
|
|
63
|
+ {
|
|
|
64
|
+ this.secretKey = secretKey;
|
|
|
65
|
+ }
|
|
|
66
|
+
|
|
|
67
|
+ public String getBucketName()
|
|
|
68
|
+ {
|
|
|
69
|
+ return bucketName;
|
|
|
70
|
+ }
|
|
|
71
|
+
|
|
|
72
|
+ public void setBucketName(String bucketName)
|
|
|
73
|
+ {
|
|
|
74
|
+ this.bucketName = bucketName;
|
|
|
75
|
+ }
|
|
|
76
|
+
|
|
|
77
|
+ @Bean
|
|
|
78
|
+ public MinioClient getMinioClient()
|
|
|
79
|
+ {
|
|
|
80
|
+ return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
|
|
|
81
|
+ }
|
|
|
82
|
+}
|