Exemple #1
0
// create a new s3 client from the url
func newS3Client(config RemoteConfig) (*s3.S3, error) {
	auth, err := getS3Auth(config)
	if err != nil {
		return &s3.S3{}, err
	}

	var regionName string
	regQuery := config.Url.Query()["region"]
	if len(regQuery) > 0 && regQuery[0] != "" {
		regionName = regQuery[0]
	} else {
		// TODO get default region from config
		regionName = S3DefaultRegion
	}

	region := aws.Regions[regionName]

	return s3.New(auth, region), nil
}
Exemple #2
0
func (s *S) SetUpSuite(c *C) {
	testServer.Start()

	auth := aws.Auth{"abc", "123", ""}
	client := s3.New(auth, aws.Region{Name: "faux-region-1", S3Endpoint: testServer.URL})

	tempDir, err := ioutil.TempDir("", "dogestry-test")
	if err != nil {
		c.Fatalf("couldn't get tempdir: %s", err)
	}

	s.tempDir = tempDir

	s.remote = &S3Remote{
		config:     baseConfig,
		BucketName: "bucket",
		KeyPrefix:  "prefix",
		client:     client,
	}
}