add forceVirtualHostedStyle for stores which only support virtual hosted style

This commit is contained in:
boxjan
2022-09-01 23:26:39 +08:00
committed by Benj Fassbind
parent b3d9055059
commit 268c39ea8c
7 changed files with 36 additions and 21 deletions
+7 -3
View File
@@ -79,15 +79,19 @@ func NewPublishedStorageRaw(
// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
// keys, region and bucket name
func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix,
storageClass, encryptionMethod string, plusWorkaround, disableMultiDel, forceSigV2, debug bool) (*PublishedStorage, error) {
func NewPublishedStorage(
accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix, storageClass, encryptionMethod string,
plusWorkaround, disableMultiDel, forceSigV2, forceVirtualHostedStyle, debug bool) (*PublishedStorage, error) {
config := &aws.Config{
Region: aws.String(region),
}
if endpoint != "" {
config = config.WithEndpoint(endpoint).WithS3ForcePathStyle(true)
config = config.WithEndpoint(endpoint)
if !forceVirtualHostedStyle {
config = config.WithS3ForcePathStyle(true)
}
}
if accessKey != "" {