[feature/backend] overall enhancement of image uploading
All checks were successful
Build Backend / Build Docker Image (push) Successful in 5m3s

This commit is contained in:
CDN 2025-02-23 04:42:48 +08:00
parent 6e1be3d513
commit 3e6181e578
Signed by: CDN
GPG key ID: 0C656827F9F80080
13 changed files with 740 additions and 314 deletions

View file

@ -49,7 +49,7 @@ type StorageConfig struct {
Type string `yaml:"type"`
Local LocalStorage `yaml:"local"`
S3 S3Storage `yaml:"s3"`
Upload types.UploadConfig `yaml:"upload"`
Upload UploadConfig `yaml:"upload"`
}
type LocalStorage struct {
@ -66,6 +66,27 @@ type S3Storage struct {
ProxyS3 bool `yaml:"proxy_s3"`
}
type UploadConfig struct {
Limits struct {
Image struct {
MaxSize int `yaml:"max_size"`
AllowedTypes []string `yaml:"allowed_types"`
} `yaml:"image"`
Video struct {
MaxSize int `yaml:"max_size"`
AllowedTypes []string `yaml:"allowed_types"`
} `yaml:"video"`
Audio struct {
MaxSize int `yaml:"max_size"`
AllowedTypes []string `yaml:"allowed_types"`
} `yaml:"audio"`
Document struct {
MaxSize int `yaml:"max_size"`
AllowedTypes []string `yaml:"allowed_types"`
} `yaml:"document"`
} `yaml:"limits"`
}
// Load loads configuration from a YAML file
func Load(path string) (*Config, error) {
data, err := os.ReadFile(path)