ISSUE-242 just some small refactoring

This commit is contained in:
Andrea Spacca 2019-06-23 21:06:58 +02:00
parent cc1a1b8487
commit 2cebb7520c
3 changed files with 4 additions and 4 deletions

View file

@ -338,7 +338,7 @@ func New() *Cmd {
panic("secret-key not set.") panic("secret-key not set.")
} else if bucket := c.String("bucket"); bucket == "" { } else if bucket := c.String("bucket"); bucket == "" {
panic("bucket not set.") panic("bucket not set.")
} else if storage, err := server.NewS3Storage(accessKey, secretKey, bucket, c.String("s3-endpoint"), logger, c.Bool("s3-no-multipart"), c.String("s3-region")); err != nil { } else if storage, err := server.NewS3Storage(accessKey, secretKey, bucket, c.String("s3-region"), c.String("s3-endpoint"), logger, c.Bool("s3-no-multipart")); err != nil {
panic(err) panic(err)
} else { } else {
options = append(options, server.UseStorage(storage)) options = append(options, server.UseStorage(storage))

View file

@ -132,8 +132,8 @@ type S3Storage struct {
noMultipart bool noMultipart bool
} }
func NewS3Storage(accessKey, secretKey, bucketName, endpoint string, logger *log.Logger, disableMultipart bool, region string) (*S3Storage, error) { func NewS3Storage(accessKey, secretKey, bucketName, region, endpoint string, logger *log.Logger, disableMultipart bool) (*S3Storage, error) {
sess := getAwsSession(accessKey, secretKey, endpoint, region) sess := getAwsSession(accessKey, secretKey, region, endpoint)
return &S3Storage{bucket: bucketName, s3: s3.New(sess), session: sess, logger: logger, noMultipart: disableMultipart}, nil return &S3Storage{bucket: bucketName, s3: s3.New(sess), session: sess, logger: logger, noMultipart: disableMultipart}, nil
} }

View file

@ -37,7 +37,7 @@ import (
"github.com/golang/gddo/httputil/header" "github.com/golang/gddo/httputil/header"
) )
func getAwsSession(accessKey, secretKey, endpoint string, region string) *session.Session { func getAwsSession(accessKey, secretKey, region, endpoint string) *session.Session {
return session.Must(session.NewSession(&aws.Config{ return session.Must(session.NewSession(&aws.Config{
Region: aws.String(region), Region: aws.String(region),
Endpoint: aws.String(endpoint), Endpoint: aws.String(endpoint),