refactor(file): 重构文件存储配置为 file-storage 并增加上传校验
- 合并 AliyunOssProperties/LocalFileProperties/MinioProperties 为 FileStorageProperties - oss.* 配置前缀统一改为 file-storage.*(type/upload/minio/aliyun/local) - FileController 增加文件扩展名白名单校验 - spring.servlet.multipart 上限改由 file-storage.upload.max-file-size 驱动
This commit is contained in:
1 parent
eb2fd56f9a
commit
666f4929e5
12 files changed
+187
-90
No files matched your search
@@ -105,36 +105,39 @@ security:
|
||||
- /favicon.ico
|
||||
- /error
|
||||
|
||||
# 文件存储配置
|
||||
oss:
|
||||
# OSS 类型 (目前支持aliyun、minio)
|
||||
# 文件存储
|
||||
file-storage:
|
||||
# 存储类型:minio | aliyun | local
|
||||
type: minio
|
||||
# MinIO 对象存储服务
|
||||
# 上传限制
|
||||
upload:
|
||||
# 单文件大小上限(同时作为 spring.servlet.multipart 的上限,单一来源)
|
||||
max-file-size: 50MB
|
||||
# 允许的文件扩展名白名单(置空表示不限制)
|
||||
allowed-extensions:
|
||||
- jpg
|
||||
- jpeg
|
||||
- png
|
||||
- gif
|
||||
# MinIO 对象存储
|
||||
minio:
|
||||
# 服务Endpoint
|
||||
endpoint: http://localhost:9000
|
||||
# 访问凭据
|
||||
access-key: minioadmin
|
||||
# 凭据密钥
|
||||
secret-key: minioadmin
|
||||
# 存储桶名称
|
||||
bucket-name: public
|
||||
# (可选)自定义域名,如果配置了域名,生成的文件URL是域名格式,未配置则URL则是IP格式 (eg: https://www.youlai.tech/storage)
|
||||
custom-domain:
|
||||
# 阿里云OSS对象存储服务
|
||||
endpoint: http://111.229.83.153:9000
|
||||
access-key: bybaddp7zyARpgNbEGKf
|
||||
secret-key: p9rBdQZPBIJcMH23iyFkZkXmmawbmwPlk3JLlaaj
|
||||
bucket: public
|
||||
# 自定义域名:配置后文件 URL 走域名,留空则用 endpoint(IP)格式
|
||||
domain:
|
||||
# 阿里云 OSS
|
||||
aliyun:
|
||||
# 服务Endpoint
|
||||
endpoint: oss-cn-hangzhou.aliyuncs.com
|
||||
# 访问凭据
|
||||
access-key-id: your-access-key-id
|
||||
# 凭据密钥
|
||||
access-key-secret: your-access-key-secret
|
||||
# 存储桶名称
|
||||
bucket-name: default
|
||||
bucket: default
|
||||
# 本地存储
|
||||
local:
|
||||
# 文件存储路径 请注意下,mac用户请使用 /Users/your-username/your-path/,否则会有权限问题,windows用户请使用 D:/your-path/
|
||||
storage-path: /Users/theo/home/
|
||||
# 存储根目录(相对路径基于工作目录;生产建议挂载独立卷)
|
||||
path: ./uploads/
|
||||
|
||||
# 短信配置
|
||||
sms:
|
||||
# 阿里云短信
|
||||
|
||||
Reference in new issue
Block a user