get.porter.sh/porter@v1.3.0/pkg/runtime/dependencies.go (about)

     1  package runtime
     2  
     3  import (
     4  	"fmt"
     5  	"path"
     6  
     7  	"get.porter.sh/porter/pkg/portercontext"
     8  )
     9  
    10  const (
    11  	BundleDependenciesDir = "/cnab/app/dependencies"
    12  )
    13  
    14  func GetDependencyDefinitionPath(alias string) string {
    15  	// Must be a unix path
    16  	return path.Join(BundleDependenciesDir, alias, "bundle.json")
    17  }
    18  
    19  func GetDependencyDefinition(c *portercontext.Context, alias string) ([]byte, error) {
    20  	f := GetDependencyDefinitionPath(alias)
    21  	data, err := c.FileSystem.ReadFile(f)
    22  	if err != nil {
    23  		return nil, fmt.Errorf("error reading bundle definition for %s at %s: %w", alias, f, err)
    24  	}
    25  	return data, nil
    26  }