removed s3 bucket from config
This commit is contained in:
@@ -2,7 +2,6 @@ package s3browser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
@@ -17,26 +16,10 @@ import (
|
||||
|
||||
// setupS3Client connect the s3Client
|
||||
func setupS3Client(config types.AppConfig) (*minio.Client, error) {
|
||||
minioClient, err := minio.New(config.S3Endoint, &minio.Options{
|
||||
return minio.New(config.S3Endoint, &minio.Options{
|
||||
Creds: credentials.NewStaticV4(config.S3AccessKey, config.S3SecretKey, ""),
|
||||
Secure: config.S3SSL,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
exists, err := minioClient.BucketExists(context.Background(), config.S3Bucket)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !exists {
|
||||
return nil, fmt.Errorf("Bucket '%s' does not exist", config.S3Bucket)
|
||||
}
|
||||
|
||||
return minioClient, nil
|
||||
}
|
||||
|
||||
// Start starts the app
|
||||
|
||||
@@ -12,7 +12,6 @@ type AppConfig struct {
|
||||
S3AccessKey string
|
||||
S3SecretKey string
|
||||
S3SSL bool
|
||||
S3Bucket string
|
||||
DSN string
|
||||
CacheTTL time.Duration
|
||||
CacheCleanup time.Duration
|
||||
|
||||
Reference in New Issue
Block a user