mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-29 22:56:39 +08:00
37 lines
599 B
Go
37 lines
599 B
Go
package storage
|
|
|
|
import (
|
|
"one-api/common/storage/drives"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
type Storage struct {
|
|
drives map[string]StorageDrive
|
|
}
|
|
|
|
func InitStorage() {
|
|
InitImgurStorage()
|
|
InitSMStorage()
|
|
}
|
|
|
|
func InitSMStorage() {
|
|
smSecret := viper.GetString("storage.smms.secret")
|
|
if smSecret == "" {
|
|
return
|
|
}
|
|
|
|
smUpload := drives.NewSMUpload(smSecret)
|
|
AddStorageDrive(smUpload)
|
|
}
|
|
|
|
func InitImgurStorage() {
|
|
imgurClientId := viper.GetString("storage.imgur.client_id")
|
|
if imgurClientId == "" {
|
|
return
|
|
}
|
|
|
|
imgurUpload := drives.NewImgurUpload(imgurClientId)
|
|
AddStorageDrive(imgurUpload)
|
|
}
|