Exemplo n.º 1
0
func New(config *config_package.Config) BlobStore {
	switch config.ActiveBlobStore() {
	case config_package.DAVBlobStore:
		return dav_blob_store.New(config.BlobStore())
	case config_package.S3BlobStore:
		return s3_blob_store.New(config.S3BlobStore())
	}

	return dav_blob_store.New(config.BlobStore())
}
Exemplo n.º 2
0
var _ = Describe("BlobStore", func() {
	var (
		blobStore  *s3_blob_store.BlobStore
		fakeServer *ghttp.Server
	)

	BeforeEach(func() {
		blobTargetInfo := config.S3BlobStoreConfig{
			AccessKey:  "some-access-key",
			SecretKey:  "some-secret-key",
			BucketName: "bucket",
			Region:     "some-s3-region",
		}

		blobStore = s3_blob_store.New(blobTargetInfo)
		blobStore.S3.Retryer = nullRetryer{}

		fakeServer = ghttp.NewServer()
		blobStore.S3.Endpoint = fakeServer.URL()
	})

	AfterEach(func() {
		fakeServer.Close()
	})

	Describe(".New", func() {
		It("returns a new BlobStore with the provided credentials, region, and bucket", func() {
			Expect(*blobStore.S3.Config.Region).To(Equal("some-s3-region"))
			Expect(*blobStore.S3.Config.S3ForcePathStyle).To(BeTrue())
			Expect(blobStore.S3.Config.Credentials.Get()).To(Equal(credentials.Value{