From 80952c9e2b75e1bc80fa138f9354d000d6a56b59 Mon Sep 17 00:00:00 2001 From: Simone Locci Date: Sun, 21 Feb 2021 15:44:19 +0100 Subject: [PATCH] Rename s3accelerate parameter to accelerate Signed-off-by: Simone Locci --- docs/configuration.md | 4 ++-- registry/storage/driver/s3-aws/s3.go | 22 +++++++++++----------- registry/storage/driver/s3-aws/s3_test.go | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 037d2912b..8cd72cae3 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -118,7 +118,7 @@ storage: secretkey: awssecretkey region: us-west-1 regionendpoint: http://myobjects.local - s3accelerate: false + accelerate: false bucket: bucketname encrypt: true keyid: mykeyid @@ -423,7 +423,7 @@ storage: secretkey: awssecretkey region: us-west-1 regionendpoint: http://myobjects.local - s3accelerate: false + accelerate: false bucket: bucketname encrypt: true keyid: mykeyid diff --git a/registry/storage/driver/s3-aws/s3.go b/registry/storage/driver/s3-aws/s3.go index fe31d390e..ba76f4248 100644 --- a/registry/storage/driver/s3-aws/s3.go +++ b/registry/storage/driver/s3-aws/s3.go @@ -104,7 +104,7 @@ type DriverParameters struct { ObjectACL string SessionToken string UseDualStack bool - S3Accelerate bool + Accelerate bool } func init() { @@ -378,21 +378,21 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) { sessionToken := "" - s3accelerateBool := false - s3accelerate := parameters["s3accelerate"] - switch s3accelerate := s3accelerate.(type) { + accelerateBool := false + accelerate := parameters["accelerate"] + switch accelerate := accelerate.(type) { case string: - b, err := strconv.ParseBool(s3accelerate) + b, err := strconv.ParseBool(accelerate) if err != nil { - return nil, fmt.Errorf("The s3accelerate parameter should be a boolean") + return nil, fmt.Errorf("the accelerate parameter should be a boolean") } - s3accelerateBool = b + accelerateBool = b case bool: - s3accelerateBool = s3accelerate + accelerateBool = accelerate case nil: // do nothing default: - return nil, fmt.Errorf("The s3accelerate parameter should be a boolean") + return nil, fmt.Errorf("the accelerate parameter should be a boolean") } params := DriverParameters{ @@ -417,7 +417,7 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) { objectACL, fmt.Sprint(sessionToken), useDualStackBool, - s3accelerateBool, + accelerateBool, } return New(params) @@ -477,7 +477,7 @@ func New(params DriverParameters) (*Driver, error) { awsConfig.WithEndpoint(params.RegionEndpoint) } - awsConfig.WithS3UseAccelerate(params.S3Accelerate) + awsConfig.WithS3UseAccelerate(params.Accelerate) awsConfig.WithRegion(params.Region) awsConfig.WithDisableSSL(!params.Secure) if params.UseDualStack { diff --git a/registry/storage/driver/s3-aws/s3_test.go b/registry/storage/driver/s3-aws/s3_test.go index 0314eaaf6..41a5fc7da 100644 --- a/registry/storage/driver/s3-aws/s3_test.go +++ b/registry/storage/driver/s3-aws/s3_test.go @@ -44,7 +44,7 @@ func init() { sessionToken := os.Getenv("AWS_SESSION_TOKEN") useDualStack := os.Getenv("S3_USE_DUALSTACK") combineSmallPart := os.Getenv("MULTIPART_COMBINE_SMALL_PART") - s3accelerate := os.Getenv("S3_ACCELERATE") + accelerate := os.Getenv("S3_ACCELERATE") if err != nil { panic(err) } @@ -96,9 +96,9 @@ func init() { } } - s3accelerateBool := true - if s3accelerate != "" { - s3accelerateBool, err = strconv.ParseBool(s3accelerate) + accelerateBool := true + if accelerate != "" { + accelerateBool, err = strconv.ParseBool(accelerate) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func init() { objectACL, sessionToken, useDualStackBool, - s3accelerateBool, + accelerateBool, } return New(parameters)