feature (plg_backend_s3): add param for forcePathStyle - #584

Co-authored-by: xiayan.cn <xiayan.cn@bytedance.com>
Co-authored-by: Mickael <mickael@kerjean.me>
This commit is contained in:
Yanick.xia
2023-04-09 11:10:33 +08:00
committed by GitHub
parent 586e803bde
commit 67e2a34853

View File

@ -75,7 +75,7 @@ func (s S3Backend) Init(params map[string]string, app *App) (IBackend, error) {
config := &aws.Config{
Credentials: credentials.NewChainCredentials(creds),
CredentialsChainVerboseErrors: aws.Bool(true),
S3ForcePathStyle: aws.Bool(true),
S3ForcePathStyle: aws.Bool(params["url_style"] == "path-style"),
Region: aws.String(params["region"]),
}
if params["endpoint"] != "" {
@ -113,7 +113,13 @@ func (s S3Backend) LoginForm() Form {
Name: "advanced",
Type: "enable",
Placeholder: "Advanced",
Target: []string{"s3_role_arn", "s3_path", "s3_session_token", "s3_encryption_key", "s3_region", "s3_endpoint"},
Target: []string{"s3_endpoint", "s3_role_arn", "s3_path", "s3_session_token", "s3_encryption_key", "s3_region", "s3_url_style"},
},
FormElement{
Id: "s3_endpoint",
Name: "endpoint",
Type: "text",
Placeholder: "Endpoint",
},
FormElement{
Id: "s3_role_arn",
@ -146,10 +152,13 @@ func (s S3Backend) LoginForm() Form {
Placeholder: "Region",
},
FormElement{
Id: "s3_endpoint",
Name: "endpoint",
Type: "text",
Placeholder: "Endpoint",
Id: "s3_url_style",
Name: "url_style",
Type: "select",
Default: "path-style",
Opts: []string{"path-style", "virtual-hostedstyle"},
Description: "Amazon S3 supports both virtual-hostedstyle and path-style URL access in all AWS Regions. Default: \"path-style\"",
Placeholder: "S3 URL Style",
},
},
}