diff --git a/bits/conf.go b/bits/conf.go index db59a26..d073aba 100644 --- a/bits/conf.go +++ b/bits/conf.go @@ -15,6 +15,9 @@ type Conf struct { //holds the aws s3 bucket name AWSS3BucketName string `json:"aws_s3_bucket_name"` + //holds the aws s3 bucket domain + AWSDomain string `json:"aws_s3_bucket_domain"` + //The aws key that has access to the above bucket AWSAccessKeyID string `json:"aws_access_key_id"` @@ -62,6 +65,8 @@ func (conf *Conf) OverwriteFromGit(repo *Repository) (err error) { conf.AWSAccessKeyID = fields[1] case "bits.aws-secret-access-key": conf.AWSSecretAccessKey = fields[1] + case "bits.aws-s3-bucket-domain": + conf.AWSDomain = fields[1] } } diff --git a/bits/repository.go b/bits/repository.go index 818c43e..e16c58b 100644 --- a/bits/repository.go +++ b/bits/repository.go @@ -145,6 +145,7 @@ func NewRepository(dir string, output io.Writer) (repo *Repository, err error) { repo.conf.AWSS3BucketName, repo.conf.AWSAccessKeyID, repo.conf.AWSSecretAccessKey, + repo.conf.AWSDomain, ) if err != nil { @@ -239,6 +240,10 @@ func (repo *Repository) Install(w io.Writer, conf *Conf) (err error) { gconf["bits.aws-s3-bucket-name"] = conf.AWSS3BucketName } + if conf.AWSDomain != "" { + gconf["bits.aws-s3-bucket-domain"] = conf.AWSDomain + } + if conf.AWSAccessKeyID != "" { gconf["bits.aws-access-key-id"] = conf.AWSAccessKeyID } @@ -261,6 +266,7 @@ func (repo *Repository) Install(w io.Writer, conf *Conf) (err error) { repo.conf.AWSS3BucketName, repo.conf.AWSAccessKeyID, repo.conf.AWSSecretAccessKey, + repo.conf.AWSDomain, ) if err != nil { diff --git a/bits/repository_test.go b/bits/repository_test.go index a169669..ba773d4 100644 --- a/bits/repository_test.go +++ b/bits/repository_test.go @@ -16,7 +16,7 @@ import ( "testing" "time" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) func GitInitRemote(t *testing.T) (dir string) { diff --git a/bits/s3.go b/bits/s3.go index 99f6ffd..2daf99e 100644 --- a/bits/s3.go +++ b/bits/s3.go @@ -17,13 +17,13 @@ type S3Remote struct { repo *Repository } -func NewS3Remote(repo *Repository, remote, bucket, accessKey, secretKey string) (s3 *S3Remote, err error) { +func NewS3Remote(repo *Repository, remote, bucket, accessKey, secretKey string, domain string) (s3 *S3Remote, err error) { s3 = &S3Remote{ repo: repo, gitRemote: remote, } - s3.bucket = s3gof3r.New("", s3gof3r.Keys{ + s3.bucket = s3gof3r.New(domain, s3gof3r.Keys{ AccessKey: accessKey, SecretKey: secretKey, }).Bucket(bucket) diff --git a/command/combine.go b/command/combine.go index 0ce8498..4ec24cb 100644 --- a/command/combine.go +++ b/command/combine.go @@ -5,7 +5,7 @@ import ( "os" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) type Combine struct { diff --git a/command/fetch.go b/command/fetch.go index c8028bc..d5823d9 100644 --- a/command/fetch.go +++ b/command/fetch.go @@ -5,7 +5,7 @@ import ( "os" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) type Fetch struct { diff --git a/command/install.go b/command/install.go index 86cbfdc..475a970 100644 --- a/command/install.go +++ b/command/install.go @@ -7,7 +7,7 @@ import ( "github.com/jessevdk/go-flags" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) var InstallOpts struct { @@ -97,6 +97,12 @@ func (cmd *Install) Run(args []string) int { return 128 } + conf.AWSDomain, err = cmd.ui.Ask("What is the AWS where domain the bucket is located? (if left empty, defaults to s3.amazonaws.com)\n") + if err != nil { + cmd.ui.Error(fmt.Sprintf("failed to get input: %v", err)) + return 128 + } + conf.AWSSecretAccessKey, err = cmd.ui.AskSecret("What is your AWS Secret Key that autorizes the above access key? (input will be hidden)\n") if err != nil { cmd.ui.Error(fmt.Sprintf("failed to get input: %v", err)) diff --git a/command/pull.go b/command/pull.go index 7747997..ed32076 100644 --- a/command/pull.go +++ b/command/pull.go @@ -5,7 +5,7 @@ import ( "os" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) type Pull struct { diff --git a/command/push.go b/command/push.go index 6d2fc4d..a78dd2d 100644 --- a/command/push.go +++ b/command/push.go @@ -5,7 +5,7 @@ import ( "os" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) type Push struct { diff --git a/command/scan.go b/command/scan.go index c26d459..7bb57c2 100644 --- a/command/scan.go +++ b/command/scan.go @@ -5,7 +5,7 @@ import ( "os" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) type Scan struct { diff --git a/command/split.go b/command/split.go index 827c3e1..7f6b6f5 100644 --- a/command/split.go +++ b/command/split.go @@ -5,7 +5,7 @@ import ( "os" "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/bits" + "github.com/jungleai/git-bits/bits" ) type Split struct { diff --git a/glide.lock b/glide.lock index 92036d9..7aa67e4 100644 --- a/glide.lock +++ b/glide.lock @@ -1,10 +1,10 @@ -hash: 4fb003669fac10230575a0b78141ef639d6013a89171772914882a736b505d55 -updated: 2016-11-25T15:08:32.306532946+01:00 +hash: 17606e0631d26abc5b49fc11e6a547fa764d7e18b4a7efc41a47db8061be8e18 +updated: 2017-10-30T12:13:35.194905297Z imports: - name: github.com/armon/go-radix - version: 4239b77079c7b5d1243b7b4736304ce8ddb6f0f2 + version: 1fca145dffbcaa8fe914309b1ec0cfc67500fe61 - name: github.com/bgentry/speakeasy - version: 675b82c74c0ed12283ee81ba8a534c8982c07b85 + version: 4aabc24848ce5fd31929f7d1e4ea74d3709c14cd - name: github.com/boltdb/bolt version: 0d9f544bb94aac29c185968483459ef74d6deb5d - name: github.com/dustin/go-humanize @@ -12,9 +12,13 @@ imports: - name: github.com/jessevdk/go-flags version: 8bc97d602c3bfeb5fc6fc9b5a9c898f245495637 - name: github.com/mattn/go-isatty - version: 66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8 + version: a5cdd64afdee435007ee3e9f6ed4684af949d568 - name: github.com/mitchellh/cli version: fa17b36f6c61f1ddbbb08c9f6fde94b3c065a09d +- name: github.com/nerdalize/git-bits + version: 11f37a9f741b2db273eb925a9ec8e16f52676405 + subpackages: + - bits - name: github.com/restic/chunker version: bb2ecf9a98e35a0b336ffc23fc515fb6e7961577 - name: github.com/rlmcpherson/s3gof3r @@ -22,7 +26,7 @@ imports: - name: github.com/VividCortex/ewma version: c595cd886c223c6c28fc9ae2727a61b5e4693d85 - name: golang.org/x/sys - version: c200b10b5d5e122be351b67af224adc6128af5bf + version: 661970f62f5897bc0cd5fdca7e087ba8a98a8fa1 subpackages: - unix testImports: [] diff --git a/glide.yaml b/glide.yaml index e751108..5a1eab6 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,4 +1,4 @@ -package: github.com/nerdalize/git-bits +package: github.com/jungleai/git-bits import: - package: github.com/mitchellh/cli #cross-platform command lines version: fa17b36f6c61f1ddbbb08c9f6fde94b3c065a09d diff --git a/main.go b/main.go index 7c3d609..effb38b 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "github.com/mitchellh/cli" - "github.com/nerdalize/git-bits/command" + "github.com/jungleai/git-bits/command" ) var (