Skip to content

Commit

Permalink
feat(blob): allow to customize whether to force path style
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: warjiang <1096409085@qq.com>
  • Loading branch information
caarlos0 and warjiang committed Jan 9, 2024
1 parent 5040227 commit e800061
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion internal/pipe/blob/upload.go
Expand Up @@ -53,7 +53,11 @@ func urlFor(ctx *context.Context, conf config.Blob) (string, error) {
}
if endpoint != "" {
query.Add("endpoint", endpoint)
query.Add("s3ForcePathStyle", "true")
if conf.S3ForcePathStyle == nil {
query.Add("s3ForcePathStyle", "true")
} else {
query.Add("s3ForcePathStyle", fmt.Sprintf("%t", *conf.S3ForcePathStyle))
}
}

region, err := tmpl.New(ctx).Apply(conf.Region)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Expand Up @@ -1103,7 +1103,7 @@ type Blob struct {
Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` // used for minio for example
ExtraFiles []ExtraFile `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
Disable string `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
ForceS3StylePath bool `yaml:"force_s3_style_path,omitempty" json:"force_s3_style_path,omitempty"`
S3ForcePathStyle *bool `yaml:"s3_force_path_style,omitempty" json:"s3_force_path_style,omitempty"`

// Deprecated: use disable_ssl instead
OldDisableSSL bool `yaml:"disableSSL,omitempty" json:"disableSSL,omitempty" jsonschema:"deprecated=true,description=use disable_ssl instead"` // nolint:tagliatelle
Expand Down
9 changes: 8 additions & 1 deletion www/docs/customization/blob.md
Expand Up @@ -33,7 +33,7 @@ blobs:

# Disables SSL
# Requires provider to be `s3`
disableSSL: true
disable_ssl: true

# Bucket name.
#
Expand Down Expand Up @@ -80,6 +80,12 @@ blobs:
- src: LICENSE.tpl
dst: LICENSE.txt

# Disable forcing of path style access on S3.
#
# Default: true.
# Since: v1.24
s3_force_path_style: false

- provider: gs
bucket: goreleaser-bucket
folder: "foo/bar/{{.Version}}"
Expand Down Expand Up @@ -117,6 +123,7 @@ blobs:
Storage account is set over URL param `storage_account` in `bucket` or in environment variable `AZURE_STORAGE_ACCOUNT`

It supports authentication with

- [environment variables](https://docs.microsoft.com/en-us/azure/storage/common/storage-azure-cli#set-default-azure-storage-account-environment-variables):
- `AZURE_STORAGE_KEY` or `AZURE_STORAGE_SAS_TOKEN`
- [default Azure credential](https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication-service-principal)
Expand Down

0 comments on commit e800061

Please sign in to comment.