Rename s3accelerate parameter to accelerate

Signed-off-by: Simone Locci <simonelocci88@gmail.com>
This commit is contained in:
Simone Locci 2021-02-21 15:44:19 +01:00 committed by Simone Locci
parent ea27621d4a
commit 80952c9e2b
No known key found for this signature in database
GPG key ID: EA8A965E9EA17D84
3 changed files with 18 additions and 18 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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)