Skip to content

Commit

Permalink
Allow forcing path style for s3 compatible API requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
johngian authored and ARolek committed Mar 4, 2021
1 parent 7f0e7e6 commit 8e40caf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cache/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
ConfigKeyACL = "access_control_list" // defaults to ""
ConfigKeyCacheControl = "cache_control" // defaults to ""
ConfigKeyContentType = "content_type" // defaults to "application/vnd.mapbox-vector-tile"
ConfigKeyS3ForcePath = "force_path_style"
)

const (
Expand All @@ -49,6 +50,7 @@ const (
DefaultSecretKey = ""
DefaultContentType = mvt.MimeType
DefaultEndpoint = ""
DefaultS3ForcePath = false
)

// testData is used during New() to confirm the ability to write, read and purge the cache
Expand Down Expand Up @@ -151,6 +153,14 @@ func New(config dict.Dicter) (cache.Interface, error) {
awsConfig.Endpoint = aws.String(endpoint)
}

s3ForcePathStyle := DefaultS3ForcePath
s3ForcePathStyle, err = config.Bool(ConfigKeyS3ForcePath, &s3ForcePathStyle)
if err != nil {
return nil, err
}

awsConfig.S3ForcePathStyle = aws.Bool(s3ForcePathStyle)

// setup the s3 session.
// if the accessKey and secreteKey are not provided (static creds) then the provider chain is used
// http://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html
Expand Down

0 comments on commit 8e40caf

Please sign in to comment.