Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type s3Config struct {
UploadFilePath string `yaml:"upload_file_path"`
APIKey string `yaml:"api_key"`
APISecret string `yaml:"secret_access_key"`
S3ForcePathStyle bool `yaml:"s3_force_path_style"`
}

// Config -
Expand Down Expand Up @@ -84,6 +85,10 @@ func (c *s3Config) validate() error {
if len(c.APISecret) == 0 {
return fmt.Errorf("missing mandatory key s3.api_secret")
}
// Default S3ForcePathStyle to false if not provided
if !c.S3ForcePathStyle {
c.S3ForcePathStyle = false
}
return nil
}

Expand Down
4 changes: 3 additions & 1 deletion manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"bytes"
"errors"
"fmt"
"os"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
log "github.com/sirupsen/logrus"
"os"
)

type Manager struct {
Expand Down Expand Up @@ -54,6 +55,7 @@ func (m *Manager) newSession() (*session.Session, error) {
config.WithRegion(m.config.S3.Region)
config.WithEndpoint(m.config.S3.URL)
config.WithMaxRetries(3)
config.WithS3ForcePathStyle(*aws.Bool(m.config.S3.S3ForcePathStyle))
return session.NewSession(config)
}

Expand Down