mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
599 B
24 lines
599 B
2 years ago
|
package dao
|
||
|
|
||
|
import (
|
||
|
"github.com/minio/minio-go/v7"
|
||
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
||
|
"github.com/rocboss/paopao-ce/global"
|
||
|
)
|
||
|
|
||
|
func newS3Servent() *s3Servant {
|
||
|
// Initialize s3 client object use minio-go.
|
||
|
client, err := minio.New(global.S3Setting.Endpoint, &minio.Options{
|
||
|
Creds: credentials.NewStaticV4(global.S3Setting.AccessKey, global.S3Setting.SecretKey, ""),
|
||
|
Secure: global.S3Setting.Secure,
|
||
|
})
|
||
|
if err != nil {
|
||
|
global.Logger.Fatalf("s3.New err: %v", err)
|
||
|
}
|
||
|
return &s3Servant{
|
||
|
client: client,
|
||
|
bucket: global.MinIOSetting.Bucket,
|
||
|
domain: getOssDomain(),
|
||
|
}
|
||
|
}
|