32 lines
555 B
Go
32 lines
555 B
Go
|
package dal
|
||
|
|
||
|
import (
|
||
|
"octopus/internal/config"
|
||
|
"octopus/pkg/storage"
|
||
|
"sync"
|
||
|
|
||
|
"github.com/rs/zerolog/log"
|
||
|
// pb "github.com/qdrant/go-client/qdrant"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
storageOnce sync.Once
|
||
|
storageInstance storage.ObjectStorage
|
||
|
)
|
||
|
|
||
|
func GetStorage() storage.ObjectStorage {
|
||
|
storageOnce.Do(initMinio)
|
||
|
return storageInstance
|
||
|
}
|
||
|
|
||
|
func initMinio() {
|
||
|
log.Info().Msg("loading minio configs")
|
||
|
|
||
|
s, err := storage.NewObjectStorage(config.Get().Databases.OSS)
|
||
|
if err != nil {
|
||
|
log.Fatal().Msgf("storage client init failed: %v", err)
|
||
|
}
|
||
|
|
||
|
storageInstance = s
|
||
|
}
|