Skip to content

Commit

Permalink
Add gof3r to have proper path-style support for S3 compatible endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Nov 5, 2016
1 parent bc1aca7 commit 8eb9bb6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions gof3r/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (cp *cpOpts) Execute(args []string) (err error) {
*conf = *s3gof3r.DefaultConfig
s3 := s3gof3r.New(cp.EndPoint, k)
conf.Concurrency = cp.Concurrency
conf.PathStyle = cp.PathStyle
if cp.NoSSL {
conf.Scheme = "http"
}
Expand Down
1 change: 1 addition & 0 deletions gof3r/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (get *getOpts) Execute(args []string) (err error) {
s3 := s3gof3r.New(get.EndPoint, k)
b := s3.Bucket(get.Bucket)
conf.Concurrency = get.Concurrency
conf.PathStyle = get.PathStyle
if get.NoSSL {
conf.Scheme = "http"
}
Expand Down
8 changes: 4 additions & 4 deletions gof3r/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ var flagTests = []flagTest{
{[]string{"gof3r", "nocmd"},
errors.New("Unknown command")},
{[]string{"gof3r", "put", "-b", "fake-bucket", "-k", "test-key"},
errors.New("Access Denied")},
errors.New("The AWS Access Key Id you provided does not exist in our records.")},
{[]string{"gof3r", "put", "-b", "fake-bucket", "-k", "key",
"-c", "1", "-s", "1024", "--debug", "--no-ssl", "--no-md5"},
errors.New("Access Denied")},
errors.New("The AWS Access Key Id you provided does not exist in our records.")},
{[]string{"gof3r", "get", "-b", "fake-bucket", "-k", "test-key"},
errors.New("Access Denied")},
errors.New("The AWS Access Key Id you provided does not exist in our records.")},
{[]string{"gof3r", "get", "-b", "fake-bucket", "-k", "key",
"-c", "1", "-s", "1024", "--debug", "--no-ssl", "--no-md5"},
errors.New("Access Denied")},
errors.New("The AWS Access Key Id you provided does not exist in our records.")},
{[]string{"gof3r", "put"},
errors.New("required flags")},
{[]string{"gof3r", "put", "-b"},
Expand Down
3 changes: 2 additions & 1 deletion gof3r/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os/exec"
"strings"

"github.com/jessevdk/go-flags"
flags "github.com/jessevdk/go-flags"
)

const (
Expand All @@ -28,6 +28,7 @@ type DataOpts struct {
Concurrency int `long:"concurrency" short:"c" default:"10" description:"Concurrency of transfers" ini-name:"concurrency"`
PartSize int64 `long:"partsize" short:"s" description:"Initial size of concurrent parts, in bytes" default:"20971520" ini-name:"partsize"`
NTry int `long:"retries" description:"Number of attempts to try" default:"10" ini-name:"retries"`
PathStyle bool `long:"path-style" description:"Enable path style calls for S3 compatible endpoints." ini-name:"path-style"`
}

// UpOpts are Options for uploading common to cp and put commands
Expand Down
1 change: 1 addition & 0 deletions gof3r/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (put *putOpts) Execute(args []string) (err error) {
conf.PartSize = put.PartSize
conf.Md5Check = !put.NoMd5
conf.NTry = put.NTry
conf.PathStyle = put.PathStyle
s3gof3r.SetLogger(os.Stderr, "", log.LstdFlags, put.Debug)

if put.Header == nil {
Expand Down

0 comments on commit 8eb9bb6

Please sign in to comment.