Ajouter objet Config pour viper.Unmarshal() #63

Merged
vlbeaudoin merged 9 commits from feature/viper-config-object into main 2023-07-04 20:06:01 -04:00
Showing only changes of commit cb92f20375 - Show all commits

View file

@ -1,6 +1,8 @@
package media package media
import ( import (
"errors"
"git.agecem.com/agecem/agecem-org/config" "git.agecem.com/agecem/agecem-org/config"
"github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
@ -8,6 +10,14 @@ import (
) )
func NewMediaClient(endpoint, accessKeyId, secretAccessKey string, useSSL bool) (*MediaClient, error) { func NewMediaClient(endpoint, accessKeyId, secretAccessKey string, useSSL bool) (*MediaClient, error) {
if accessKeyId == "" {
return nil, errors.New("accessKeyId was found empty, but cannot be")
}
if secretAccessKey == "" {
return nil, errors.New("secretAccessKey was found empty, but cannot be")
}
var mediaClient MediaClient var mediaClient MediaClient
minioClient, err := minio.New(endpoint, &minio.Options{ minioClient, err := minio.New(endpoint, &minio.Options{
Creds: credentials.NewStaticV4(accessKeyId, secretAccessKey, ""), Creds: credentials.NewStaticV4(accessKeyId, secretAccessKey, ""),