Add -s3-force-path-style flag and config option (#157)

This option forces path-style addressing instead of using a subdomain.
This appears to be needed by Minio.
This commit is contained in:
mutantmonkey 2019-01-25 08:10:06 +00:00 committed by Andrei Marcu
parent 35c4415f8d
commit 207c19e3df
3 changed files with 9 additions and 3 deletions

View file

@ -177,7 +177,7 @@ func (b S3Backend) List() ([]string, error) {
return output, nil
}
func NewS3Backend(bucket string, region string, endpoint string) S3Backend {
func NewS3Backend(bucket string, region string, endpoint string, forcePathStyle bool) S3Backend {
awsConfig := &aws.Config{}
if region != "" {
awsConfig.Region = aws.String(region)
@ -185,6 +185,9 @@ func NewS3Backend(bucket string, region string, endpoint string) S3Backend {
if endpoint != "" {
awsConfig.Endpoint = aws.String(endpoint)
}
if forcePathStyle == true {
awsConfig.S3ForcePathStyle = aws.Bool(true)
}
sess := session.Must(session.NewSession(awsConfig))
svc := s3.New(sess)