mitao
2025-01-21 e02a3eee8217ae6bff5890d1ece6ee1f342e03dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.ruoyi.file.config;
 
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
import javax.annotation.PostConstruct;
 
/**
 * 存储-配置
 *
 * @author mitao
 */
@ConfigurationProperties(prefix = "oss")
@Component
@Slf4j
@Data
public class OssConfig {
 
    private String folder = "dev";
 
    private String accessKeyId;
 
    private String accessKeySecret;
 
    private String uploadEndpoint;
 
    private String downloadEndpoint;
 
    private String bucketName;
 
    public static String FOLDER;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String UPLOAD_ENDPOINT;
    public static String DOWNLOAD_ENDPOINT;
    public static String BUCKET_NAME;
 
 
    @PostConstruct
    public void init() {
 
        log.debug("OSS配置信息:" + JSONObject.toJSONString(this));
        FOLDER = folder;
        ACCESS_KEY_ID = accessKeyId;
        ACCESS_KEY_SECRET = accessKeySecret;
        UPLOAD_ENDPOINT = uploadEndpoint;
        DOWNLOAD_ENDPOINT = downloadEndpoint;
        BUCKET_NAME = bucketName;
    }
 
    public String getStoreFolder() {
 
        return getFolder();
    }
 
}