github.com/chenbh/concourse/v6@v6.4.2/atc/resource/tracker_metadata.go (about)

     1  package resource
     2  
     3  import "fmt"
     4  
     5  type TrackerMetadata struct {
     6  	ExternalURL  string
     7  	PipelineName string
     8  	ResourceName string
     9  }
    10  
    11  type EmptyMetadata struct{}
    12  
    13  func (m EmptyMetadata) Env() []string {
    14  	return nil
    15  }
    16  
    17  func (m TrackerMetadata) Env() []string {
    18  	var env []string
    19  
    20  	if m.ExternalURL != "" {
    21  		env = append(env, fmt.Sprintf("ATC_EXTERNAL_URL=%s", m.ExternalURL))
    22  	}
    23  
    24  	if m.PipelineName != "" {
    25  		env = append(env, fmt.Sprintf("RESOURCE_PIPELINE_NAME=%s", m.PipelineName))
    26  	}
    27  
    28  	if m.ResourceName != "" {
    29  		env = append(env, fmt.Sprintf("RESOURCE_NAME=%s", m.ResourceName))
    30  	}
    31  
    32  	return env
    33  }