CreateStorageBackend creates the appropriate storage backend based on config
(config *StorageConfig)
| 130 | |
| 131 | // CreateStorageBackend creates the appropriate storage backend based on config |
| 132 | func CreateStorageBackend(config *StorageConfig) (StorageBackend, error) { |
| 133 | switch strings.ToLower(config.Backend) { |
| 134 | case "rekor": |
| 135 | return NewRekorBackend(config) |
| 136 | case "local": |
| 137 | return NewLocalBackend(config) |
| 138 | default: |
| 139 | return nil, fmt.Errorf("unsupported storage backend: %s. Supported backends: rekor, local", config.Backend) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // UploadVSAEnvelope uploads a VSA envelope to the configured storage backends |
| 144 | func UploadVSAEnvelope(ctx context.Context, envelopePath string, storageConfigs []string, signer *Signer) error { |