data2minio/minio/index.go

24 lines
520 B
Go
Raw Normal View History

2023-04-01 16:43:13 +08:00
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
}