github.com/chenbh/concourse/v6@v6.4.2/worker/workercmd/worker_config.go (about)

     1  package workercmd
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/chenbh/concourse/v6/atc"
     7  )
     8  
     9  type WorkerConfig struct {
    10  	Name     string   `long:"name"  description:"The name to set for the worker during registration. If not specified, the hostname will be used."`
    11  	Tags     []string `long:"tag"   description:"A tag to set during registration. Can be specified multiple times."`
    12  	TeamName string   `long:"team"  description:"The name of the team that this worker will be assigned to."`
    13  
    14  	HTTPProxy  string `long:"http-proxy"  env:"http_proxy"                  description:"HTTP proxy endpoint to use for containers."`
    15  	HTTPSProxy string `long:"https-proxy" env:"https_proxy"                 description:"HTTPS proxy endpoint to use for containers."`
    16  	NoProxy    string `long:"no-proxy"    env:"no_proxy"                    description:"Blacklist of addresses to skip the proxy when reaching."`
    17  
    18  	Ephemeral bool `long:"ephemeral" description:"If set, the worker will be immediately removed upon stalling."`
    19  
    20  	Version string `long:"version" hidden:"true" description:"Version of the worker. This is normally baked in to the binary, so this flag is hidden."`
    21  }
    22  
    23  func (c WorkerConfig) Worker() atc.Worker {
    24  	return atc.Worker{
    25  		Tags:          c.Tags,
    26  		Team:          c.TeamName,
    27  		Name:          c.Name,
    28  		StartTime:     time.Now().Unix(),
    29  		Version:       c.Version,
    30  		HTTPProxyURL:  c.HTTPProxy,
    31  		HTTPSProxyURL: c.HTTPSProxy,
    32  		NoProxy:       c.NoProxy,
    33  		Ephemeral:     c.Ephemeral,
    34  	}
    35  }