diff --git a/config/config.go b/config/config.go index 165e6de79d9..d5d9bdb412b 100644 --- a/config/config.go +++ b/config/config.go @@ -7,8 +7,6 @@ import ( "strings" "time" - "github.com/treeverse/lakefs/block/gcs" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" @@ -21,6 +19,7 @@ import ( "github.com/spf13/viper" "github.com/treeverse/lakefs/auth" "github.com/treeverse/lakefs/block" + "github.com/treeverse/lakefs/block/gcs" "github.com/treeverse/lakefs/block/local" "github.com/treeverse/lakefs/block/mem" s3a "github.com/treeverse/lakefs/block/s3" @@ -234,7 +233,18 @@ func (c *Config) buildS3Adapter() (block.Adapter, error) { return nil, err } sess.ClientConfig(s3.ServiceName) - svc := s3.New(sess) + + awsConfig := aws.NewConfig() + s3Endpoint := viper.GetString("blockstore.s3.endpoint") + if len(s3Endpoint) > 0 { + awsConfig = awsConfig.WithEndpoint(s3Endpoint) + } + s3ForcePathStyle := viper.GetBool("blockstore.s3.force_path_style") + if s3ForcePathStyle { + awsConfig = awsConfig.WithS3ForcePathStyle(true) + } + + svc := s3.New(sess, awsConfig) adapter := s3a.NewAdapter(svc, s3a.WithStreamingChunkSize(viper.GetInt("blockstore.s3.streaming_chunk_size")), s3a.WithStreamingChunkTimeout(viper.GetDuration("blockstore.s3.streaming_chunk_timeout")))