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

     1  package runtime
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"get.porter.sh/porter/pkg/manifest"
     7  )
     8  
     9  // ReadDependencyOutputValue reads the dependency's output using the alias for the dependency from the
    10  // specified output parameter source (name).
    11  func (m *RuntimeManifest) ReadDependencyOutputValue(ref manifest.DependencyOutputReference) (string, error) {
    12  	ps := manifest.GetParameterSourceForDependency(ref)
    13  	psEnvVar := manifest.ParamToEnvVar(ps)
    14  	output, ok := m.config.LookupEnv(psEnvVar)
    15  	if !ok {
    16  		err := fmt.Errorf("bundle dependency %s output %s was not passed into the runtime", ref.Dependency, ref.Output)
    17  		return "", err
    18  	}
    19  
    20  	return output, nil
    21  }