27 lines
493 B
Go
27 lines
493 B
Go
package util
|
|
|
|
import (
|
|
"github.com/minio/minio-go/v7"
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
)
|
|
|
|
type S3 struct {
|
|
Endpoint string
|
|
AccessKeyID string
|
|
SecretAccessKey string
|
|
UseSSL bool
|
|
Client *minio.Client
|
|
}
|
|
|
|
func (s *S3) Init() error {
|
|
var err error
|
|
s.Client, err = minio.New(s.Endpoint, &minio.Options{
|
|
Creds: credentials.NewStaticV4(s.AccessKeyID, s.SecretAccessKey, ""),
|
|
Secure: s.UseSSL,
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|