修改文件上传逻辑配置
This commit is contained in:
@@ -8,10 +8,11 @@ import (
|
||||
|
||||
// Config 应用配置结构体
|
||||
type Config struct {
|
||||
Server ServerConfig `yaml:"server"`
|
||||
OSS OSSConfig `yaml:"oss"`
|
||||
MySQL MySQLConfig `yaml:"mysql"`
|
||||
Upload UploadConfig `yaml:"upload"`
|
||||
Server ServerConfig `yaml:"server"`
|
||||
OSS OSSConfig `yaml:"oss"`
|
||||
MySQL MySQLConfig `yaml:"mysql"`
|
||||
Upload UploadConfig `yaml:"upload"`
|
||||
FileUpload FileUploadConfig `yaml:"fileupload"`
|
||||
}
|
||||
|
||||
// ServerConfig 服务器配置
|
||||
@@ -45,6 +46,13 @@ type UploadConfig struct {
|
||||
MaxFileSize int64 `yaml:"max_file_size"`
|
||||
}
|
||||
|
||||
type FileUploadConfig struct {
|
||||
MaxFileSize int64 `yaml:"max_file_size"` // 最大文件大小(字节)
|
||||
AllowFileTypes string `yaml:"allow_file_types"` // 允许的文件类型,用逗号分隔
|
||||
ChunkSize int64 `yaml:"chunk_size"` // 分片大小(5MB)
|
||||
TempDir string `yaml:"temp_dir"` // 分片临时存储目录
|
||||
}
|
||||
|
||||
// LoadConfig 从文件加载配置
|
||||
func LoadConfig(filename string) (*Config, error) {
|
||||
data, err := os.ReadFile(filename)
|
||||
|
||||
Reference in New Issue
Block a user