get.porter.sh/porter@v1.3.0/pkg/storage/helpers.go (about)

     1  package storage
     2  
     3  import (
     4  	"get.porter.sh/porter/pkg/config"
     5  	"get.porter.sh/porter/pkg/storage/plugins/testplugin"
     6  	"github.com/cnabio/cnab-go/secrets/host"
     7  )
     8  
     9  var _ Store = TestStore{}
    10  
    11  type TestStore struct {
    12  	testPlugin *testplugin.TestStoragePlugin
    13  	PluginAdapter
    14  }
    15  
    16  func NewTestStore(tc *config.TestConfig) TestStore {
    17  	testPlugin := testplugin.NewTestStoragePlugin(tc.TestContext)
    18  	return TestStore{
    19  		testPlugin:    testPlugin,
    20  		PluginAdapter: NewPluginAdapter(testPlugin),
    21  	}
    22  }
    23  
    24  func (s TestStore) Close() error {
    25  	return s.testPlugin.Close()
    26  }
    27  
    28  func isHandledByHostPlugin(strategy string) bool {
    29  	return strategy == host.SourceCommand || strategy == host.SourceEnv || strategy == host.SourcePath || strategy == host.SourceValue
    30  }