created media storage package + interface

This commit is contained in:
nquidox 2025-10-15 19:44:41 +03:00
parent 218e7d652f
commit 1a67c02e00
3 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,35 @@
package mediaStorage
import (
"fmt"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
log "github.com/sirupsen/logrus"
)
type Handler struct {
*Service
}
type Deps struct {
Host string
Port string
User string
Password string
}
func NewHandler(deps Deps) *Handler {
endpoint := fmt.Sprintf("%s:%s", deps.Host, deps.Port)
minioClient, err := minio.New(endpoint, &minio.Options{
Creds: credentials.NewStaticV4(deps.User, deps.Password, ""),
Secure: false,
})
if err != nil {
log.WithError(err).Fatal("Media storage | Failed to create minio client")
}
return &Handler{
newService(minioClient),
}
}