diff --git a/server/internal/command/admin/cmd.go b/server/internal/command/admin/cmd.go index cfe2552e..fb3595dd 100644 --- a/server/internal/command/admin/cmd.go +++ b/server/internal/command/admin/cmd.go @@ -2,6 +2,7 @@ package admin import ( "github.com/shroff/phylum/server/internal/command/admin/schema" + "github.com/shroff/phylum/server/internal/command/admin/storage" "github.com/shroff/phylum/server/internal/command/admin/user" "github.com/spf13/cobra" ) @@ -14,7 +15,7 @@ func SetupCommand() *cobra.Command { cmd.AddCommand([]*cobra.Command{ user.SetupCommand(), schema.SetupCommand(), - // storage.SetupCommand(), + storage.SetupCommand(), }...) return cmd diff --git a/server/internal/core/jobs.go b/server/internal/core/jobs.go index 8cf69e51..71ebea5c 100644 --- a/server/internal/core/jobs.go +++ b/server/internal/core/jobs.go @@ -15,7 +15,6 @@ func moveVersionToTargetBackend(db db.Handler, versionID uuid.UUID) { } } func moveVersionToTargetBackendErr(db db.Handler, versionID uuid.UUID) error { - logrus.Info("Moving to Target Storage: " + versionID.String()) if current, err := getCurrentStorage(db, versionID); err != nil { return errors.New("failed to get current storage: " + err.Error()) } else if target, err := findTargetStorageForVersion(db, versionID); err != nil { diff --git a/server/internal/storage/drivers.go b/server/internal/storage/drivers.go index ba4a3c2a..b8d5a6c7 100644 --- a/server/internal/storage/drivers.go +++ b/server/internal/storage/drivers.go @@ -4,18 +4,21 @@ import "errors" var drivers = map[string]Driver{ "local": { + Name: "local", Params: []string{"root"}, Create: func(name string, params map[string]string) (Backend, error) { return createLocalBackend(name, params) }, }, "minio": { + Name: "minio", Params: []string{"endpoint", "key_id", "access_key", "bucket_name", "prefix"}, Create: createMinioBackend, }, } type Driver struct { + Name string Params []string Create func(name string, params map[string]string) (Backend, error) } diff --git a/server/internal/storage/local_storage.go b/server/internal/storage/local_storage.go index 8a874679..1a7b5f4d 100644 --- a/server/internal/storage/local_storage.go +++ b/server/internal/storage/local_storage.go @@ -101,5 +101,5 @@ func (l localStorage) path(name string) string { } func (l localStorage) String() string { - return "local (" + string(l.root) + ")" + return "local (root: " + string(l.root) + ")" } diff --git a/server/internal/storage/storage.go b/server/internal/storage/storage.go index d3837405..bcc9d6b1 100644 --- a/server/internal/storage/storage.go +++ b/server/internal/storage/storage.go @@ -93,7 +93,7 @@ func InsertBackend(db db.Handler, name string, driver Driver, params map[string] if err != nil { return err } - if _, err := db.Exec(q, name, driver, p); err != nil { + if _, err := db.Exec(q, name, driver.Name, p); err != nil { return err } backends[name] = backend