37 lines
653 B
Go
37 lines
653 B
Go
package minioDB
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net/http"
|
|
|
|
"github.com/minio/minio-go/v7"
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
)
|
|
|
|
type client struct {
|
|
minioClient *minio.Client
|
|
}
|
|
|
|
func New(
|
|
endpoint, accessKeyID, secretAccessKey string,
|
|
useSSL bool,
|
|
) (*client, error) {
|
|
minioClient, errNew := minio.New(endpoint, &minio.Options{
|
|
Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
|
|
Secure: useSSL,
|
|
Transport: &http.Transport{
|
|
TLSClientConfig: &tls.Config{
|
|
InsecureSkipVerify: true,
|
|
},
|
|
},
|
|
})
|
|
if errNew != nil {
|
|
return nil, errNew
|
|
}
|
|
|
|
client := &client{
|
|
minioClient: minioClient,
|
|
}
|
|
return client, nil
|
|
}
|