mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
Remove storage connector (#457)
* get rid of fake storage.Connector * get rid of the storage.Connector for mango & rdbms * Remove all the connector interfaces * Updating all the test to get rid of the connect * Updating connection to storage for proxy * Updating connection to storage for olympus * get rid of fake storage.Connector * get rid of the storage.Connector for mango & rdbms * Remove all the connector interfaces * Updating all the test to get rid of the connect * Updating connection to storage for proxy * Updating connection to storage for olympus * Fix reviews * Fix reviews * fixing op Name * fix replace the check of an error insted of the object exists * Fix error message in the test
This commit is contained in:
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
// GetStorage returns storage backend based on env configuration
|
||||
func GetStorage() (storage.BackendConnector, error) {
|
||||
func GetStorage() (storage.Backend, error) {
|
||||
storageType := env.StorageTypeWithDefault("memory")
|
||||
var storageRoot string
|
||||
var err error
|
||||
@@ -30,7 +30,7 @@ func GetStorage() (storage.BackendConnector, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mongo.NewStorage(storageRoot), nil
|
||||
return mongo.NewStorage(storageRoot)
|
||||
case "disk":
|
||||
storageRoot, err = env.DiskRoot()
|
||||
if err != nil {
|
||||
@@ -40,13 +40,13 @@ func GetStorage() (storage.BackendConnector, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not create new storage from os fs (%s)", err)
|
||||
}
|
||||
return storage.NoOpBackendConnector(s), nil
|
||||
return s, nil
|
||||
case "postgres", "sqlite", "cockroach", "mysql":
|
||||
storageRoot, err = env.RdbmsName()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rdbms.NewRDBMSStorage(storageRoot), nil
|
||||
return rdbms.NewRDBMSStorage(storageRoot)
|
||||
case "minio":
|
||||
endpoint, err := env.MinioEndpoint()
|
||||
if err != nil {
|
||||
@@ -65,8 +65,7 @@ func GetStorage() (storage.BackendConnector, error) {
|
||||
if useSSLVar := env.MinioSSLWithDefault("yes"); strings.ToLower(useSSLVar) == "no" {
|
||||
useSSL = false
|
||||
}
|
||||
s, err := minio.NewStorage(endpoint, accessKeyID, secretAccessKey, bucketName, useSSL)
|
||||
return storage.NoOpBackendConnector(s), err
|
||||
return minio.NewStorage(endpoint, accessKeyID, secretAccessKey, bucketName, useSSL)
|
||||
case "gcp":
|
||||
return gcp.New(context.Background())
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user