Ajouter validation d'accessKeyId et secretAccessKey vides
This commit is contained in:
parent
aaf8521984
commit
cb92f20375
1 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
package media
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"git.agecem.com/agecem/agecem-org/config"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
|
@ -8,6 +10,14 @@ import (
|
|||
)
|
||||
|
||||
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
|
||||
minioClient, err := minio.New(endpoint, &minio.Options{
|
||||
Creds: credentials.NewStaticV4(accessKeyId, secretAccessKey, ""),
|
||||
|
|
Loading…
Reference in a new issue