liyong
3 天以前 d62a74c14a4002c0f401c94976fba8cc77cda6e1
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
package cn.iocoder.yudao.module.system.framework.storage.config;
 
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.unit.DataSize;
 
import java.math.BigDecimal;
 
/**
 * 文件上传配置类
 *
 * 对应 application.yml 中的 yudao.storage 前缀配置
 */
@Component
@ConfigurationProperties(prefix = "yudao.storage", ignoreUnknownFields = true)
@Data
public class StorageProperties {
 
    /** 文件存储根目录 */
    private String path = "/data/uploads";
 
    /** URL路径前缀(如 /admin-api/system/storage-file),用于拼接预览/下载地址 */
    private String urlPrefix = "/admin-api/system/storage-file";
 
    /** 域名前缀,用于拼接完整的预览/下载地址 */
    private String domain = "http://localhost:48080";
 
    /** token过期时间(分钟),默认120分钟 */
    private BigDecimal expired = new BigDecimal("120");
 
    /** token使用次数上限,默认10次 */
    private Integer useLimit = 10;
 
    /** JWT密钥 */
    private String jwtSecret = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG";
 
    /** 是否启用图片压缩 */
    private Boolean compress = true;
 
    /** 触发压缩的文件大小阈值 */
    private DataSize needCompressSize = DataSize.ofMegabytes(10);
 
    /** 压缩质量(0.0~1.0) */
    private float compressQuality = 0.5f;
 
}