-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
s3.go: Added options to use paths with S3 and the ability to disable SSL #3730
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a7ff829
s3.go: Added options to use paths with S3 and the ability to disable SSL
jpds f8a3a77
s3.go: Convert new string options to booleans for AWS config.
jpds fe7422c
s3 docs: Updated to match new string-based options.
jpds 4ead2f5
s3.go: Corrections per PR review.
jpds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,22 @@ func NewS3Backend(conf map[string]string, logger log.Logger) (physical.Backend, | |
} | ||
} | ||
} | ||
s3ForceStylePathStr, ok := conf["s3_force_style_path"] | ||
if !ok { | ||
s3ForceStylePathStr = "false" | ||
} | ||
s3ForceStylePathBool, err := strconv.ParseBool(s3ForceStylePathStr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use parseutil.ParseBool instead. |
||
if err != nil { | ||
return nil, fmt.Errorf("invalid boolean set for s3_force_style_path: '%s'", s3ForceStylePathStr) | ||
} | ||
disableSSLStr, ok := conf["disable_ssl"] | ||
if !ok { | ||
disableSSLStr = "false" | ||
} | ||
disableSSLBool, err := strconv.ParseBool(disableSSLStr) | ||
if err != nil { | ||
return nil, fmt.Errorf("invalid boolean set for disable_ssl: '%s'", disableSSLStr) | ||
} | ||
|
||
credsConfig := &awsutil.CredentialsConfig{ | ||
AccessKey: accessKey, | ||
|
@@ -91,8 +107,10 @@ func NewS3Backend(conf map[string]string, logger log.Logger) (physical.Backend, | |
HTTPClient: &http.Client{ | ||
Transport: pooledTransport, | ||
}, | ||
Endpoint: aws.String(endpoint), | ||
Region: aws.String(region), | ||
Endpoint: aws.String(endpoint), | ||
Region: aws.String(region), | ||
S3ForcePathStyle: aws.Bool(s3ForceStylePathBool), | ||
DisableSSL: aws.Bool(disableSSLBool), | ||
})) | ||
|
||
_, err = s3conn.ListObjects(&s3.ListObjectsInput{Bucket: &bucket}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this and the following value to s3ForcePathStyle, which matches the actual parameter (PathStyle instead of StylePath).