2019-08-28 01:07:50 +00:00
|
|
|
package arn
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2021-11-22 12:50:47 +00:00
|
|
|
"github.com/minio/minio-go/v7"
|
|
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
2019-08-28 01:07:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Spaces represents our file storage server.
|
|
|
|
var Spaces *minio.Client
|
|
|
|
|
|
|
|
// initSpaces starts our file storage client.
|
|
|
|
func initSpaces() {
|
|
|
|
if APIKeys.S3.ID == "" || APIKeys.S3.Secret == "" {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
go func() {
|
|
|
|
var err error
|
|
|
|
endpoint := "sfo2.digitaloceanspaces.com"
|
|
|
|
|
|
|
|
// Initiate a client using DigitalOcean Spaces.
|
2021-11-22 12:50:47 +00:00
|
|
|
Spaces, err = minio.New(endpoint, &minio.Options{
|
|
|
|
Secure: true,
|
|
|
|
Creds: credentials.NewStaticV4(APIKeys.S3.ID, APIKeys.S3.Secret, ""),
|
|
|
|
})
|
2019-08-28 01:07:50 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|