From 686630b2df2178ef404e05e535c686ccb9bd62fc Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Thu, 4 Nov 2021 20:40:00 +0100 Subject: [PATCH] removed s3 bucket from config --- .env | 1 - cmd/s3Browser.go | 2 -- internal/s3Broswer.go | 19 +------------------ internal/types/types.go | 1 - 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/.env b/.env index 72e6f2c..241ae95 100644 --- a/.env +++ b/.env @@ -2,7 +2,6 @@ S3_ENDPOINT=localhost:9000 S3_ACCESS_KEY=testo S3_SECRET_KEY=testotesto -S3_BUCKET=dev S3_DISABLE_SSL=true ADDRESS=:8080 VERBOSE=true diff --git a/cmd/s3Browser.go b/cmd/s3Browser.go index 3699e93..7866dab 100644 --- a/cmd/s3Browser.go +++ b/cmd/s3Browser.go @@ -12,7 +12,6 @@ type args struct { S3Endpoint string `arg:"--s3-endpoint,required,env:S3_ENDPOINT" help:"host[:port]" placeholder:"ENDPOINT"` S3AccessKey string `arg:"--s3-access-key,required,env:S3_ACCESS_KEY" placeholder:"ACCESS_KEY"` S3SecretKey string `arg:"--s3-secret-key,required,env:S3_SECRET_KEY" placeholder:"SECRET_KEY"` - S3Bucket string `arg:"--s3-bucket,required,env:S3_BUCKET" placeholder:"BUCKET"` S3DisableSSL bool `arg:"--s3-disable-ssl,env:S3_DISABLE_SSL" default:"false"` Address string `arg:"--address,env:ADDRESS" default:":3000" help:"what address to listen on" placeholder:"ADDRESS"` CacheTTL int64 `arg:"--cache-ttl,env:CACHE_TTL" help:"Time in seconds" default:"30" placeholder:"TTL"` @@ -35,7 +34,6 @@ func main() { S3SSL: !args.S3DisableSSL, S3AccessKey: args.S3AccessKey, S3SecretKey: args.S3SecretKey, - S3Bucket: args.S3Bucket, DSN: args.DBConnection, CacheTTL: time.Duration(args.CacheTTL) * time.Second, CacheCleanup: time.Duration(args.CacheCleanup) * time.Second, diff --git a/internal/s3Broswer.go b/internal/s3Broswer.go index c4dfdb4..adab13c 100644 --- a/internal/s3Broswer.go +++ b/internal/s3Broswer.go @@ -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 diff --git a/internal/types/types.go b/internal/types/types.go index d76df5f..094a6af 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -12,7 +12,6 @@ type AppConfig struct { S3AccessKey string S3SecretKey string S3SSL bool - S3Bucket string DSN string CacheTTL time.Duration CacheCleanup time.Duration