feat(media): add MinIO storage switch and HTTPS OSS endpoint

This commit is contained in:
richjohnrambo
2026-10-17 22:35:04 +08:00
parent 4c2c35b55b
commit 73c3dc0541
14 changed files with 682 additions and 80 deletions
+5 -4
View File
@@ -281,17 +281,17 @@ func resolveMediaHandlerConfig(config *mediaConfig) (string, string, error) {
conf = string(params)
}
}
if handler == "oss" {
ossConf, err := ensureOSSUsesSysConfig(conf)
if handler == "oss" || handler == "minio" {
storageConf, err := ensureObjectStorageUsesSysConfig(conf, handler)
if err != nil {
return "", "", err
}
return handler, ossConf, nil
return handler, storageConf, nil
}
return handler, conf, nil
}
func ensureOSSUsesSysConfig(conf string) (string, error) {
func ensureObjectStorageUsesSysConfig(conf, provider string) (string, error) {
params := map[string]any{}
if strings.TrimSpace(conf) != "" {
if err := json.Unmarshal([]byte(conf), &params); err != nil {
@@ -299,6 +299,7 @@ func ensureOSSUsesSysConfig(conf string) (string, error) {
}
}
params["use_sys_config"] = true
params["provider"] = provider
encoded, err := json.Marshal(params)
if err != nil {
return "", err