24 lines
520 B
Go
24 lines
520 B
Go
package minio
|
|
|
|
import (
|
|
minio "github.com/minio/minio-go/v7"
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
|
|
"data_minio/global"
|
|
)
|
|
|
|
func NewMinioClient(endpoint, successKeyId, secretAccessKey string) *minio.Client {
|
|
opt := &minio.Options{
|
|
Creds: credentials.NewStaticV4(successKeyId, secretAccessKey, ""),
|
|
Secure: false,
|
|
}
|
|
minioClient, err := minio.New(endpoint, opt)
|
|
if err != nil {
|
|
global.Logger.With(
|
|
zap.String("应用名称", Cfg.Name),
|
|
).Error(err.Error())
|
|
return nil
|
|
}
|
|
return minioClient
|
|
}
|