Esempio n. 1
0
func NewVerifier(config *config_package.Config) Verifier {
	switch config.ActiveBlobStore() {
	case config_package.DAVBlobStore:
		return dav_blob_store.Verifier{}
	case config_package.S3BlobStore:
		return &s3_blob_store.Verifier{}
	}

	return dav_blob_store.Verifier{}
}
Esempio n. 2
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())
}
Esempio n. 3
0
func (v BlobStoreVerifier) Verify(config *config_package.Config) (authorized bool, err error) {
	switch config.ActiveBlobStore() {
	case config_package.DAVBlobStore:
		return v.DAVBlobStoreVerifier.Verify(config)
	case config_package.S3BlobStore:
		return v.S3BlobStoreVerifier.Verify(config)
	}

	panic("unknown blob store type")
}
Esempio n. 4
0
			Expect(testPersister.target).To(Equal("mysavedapi.com"))
			Expect(testConfig.Receptor()).To(Equal("http://*****:*****@receptor.mysavedapi.com"))
		})

		It("returns errors from loading the config", func() {
			testPersister.err = errors.New("Error")

			err := testConfig.Load()
			Expect(err).To(MatchError("Error"))
		})
	})

	Describe("ActiveBlobStore", func() {
		It("defaults to 'dav'", func() {
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("dav"))
		})

		It("reports the active blobstore", func() {
			testConfig.SetS3BlobStore("some-access-key", "some-secret-key", "some-bucket-name", "some-s3-region")
			Expect(testConfig.ActiveBlobStore().String()).To(Equal("s3"))
		})
	})

	Describe("TargetBlob", func() {
		It("sets the blob target", func() {
			testConfig.SetBlobStore("some-host", "7474", "some-username", "some-password")

			Expect(testConfig.BlobStore()).To(Equal(config.BlobStoreConfig{
				Host:     "some-host",
				Port:     "7474",