fix: 初验针对修改
This commit is contained in:
21
internal/storage/factory/factory.go
Normal file
21
internal/storage/factory/factory.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package factory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.apinb.com/ops/files/internal/config"
|
||||
"git.apinb.com/ops/files/internal/storage"
|
||||
"git.apinb.com/ops/files/internal/storage/aliyun"
|
||||
"git.apinb.com/ops/files/internal/storage/local"
|
||||
)
|
||||
|
||||
func New(storageConfig config.StorageConf) (storage.Backend, error) {
|
||||
switch storageConfig.Provider {
|
||||
case "local":
|
||||
return local.New(storageConfig)
|
||||
case "aliyun":
|
||||
return aliyun.New(storageConfig.Aliyun, storageConfig.AccessTTLSeconds)
|
||||
default:
|
||||
return nil, fmt.Errorf("不支持的文件存储类型: %s", storageConfig.Provider)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user