MCPcopy Index your code
hub / github.com/coder/coder / workspaceAgent

Function workspaceAgent

cli/agent.go:43–565  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41)
42
43func workspaceAgent() *serpent.Command {
44 var (
45 logDir string
46 scriptDataDir string
47 pprofAddress string
48 noReap bool
49 sshMaxTimeout time.Duration
50 tailnetListenPort int64
51 prometheusAddress string
52 debugAddress string
53 slogHumanPath string
54 slogJSONPath string
55 slogStackdriverPath string
56 blockFileTransfer bool
57 blockReversePortForwarding bool
58 blockLocalPortForwarding bool
59 agentHeaderCommand string
60 agentHeader []string
61 devcontainers bool
62 devcontainerProjectDiscovery bool
63 devcontainerDiscoveryAutostart bool
64 socketServerEnabled bool
65 socketPath string
66 boundaryLogProxySocketPath string
67 )
68 agentAuth := &AgentAuth{}
69 cmd := &serpent.Command{
70 Use: "agent",
71 Short: `Starts the Coder workspace agent.`,
72 // This command isn't useful to manually execute.
73 Hidden: true,
74 Handler: func(inv *serpent.Invocation) error {
75 ctx, cancel := context.WithCancelCause(inv.Context())
76 defer func() {
77 cancel(xerrors.New("agent exited"))
78 }()
79
80 var (
81 ignorePorts = map[int]string{}
82 isLinux = runtime.GOOS == "linux"
83
84 sinks = []slog.Sink{}
85 logClosers = []func() error{}
86 )
87 defer func() {
88 for _, closer := range logClosers {
89 _ = closer()
90 }
91 }()
92
93 addSinkIfProvided := func(sinkFn func(io.Writer) slog.Sink, loc string) error {
94 switch loc {
95 case "":
96 // Do nothing.
97
98 case "/dev/stderr":
99 sinks = append(sinks, sinkFn(inv.Stderr))
100

Callers 1

CoreSubcommandsMethod · 0.85

Calls 15

CloseMethod · 0.95
CreateClientMethod · 0.95
AttachOptionsMethod · 0.95
IsInitProcessFunction · 0.92
ForkReapFunction · 0.92
WithExecArgsFunction · 0.92
WithCatchSignalsFunction · 0.92
WithLoggerFunction · 0.92
VersionFunction · 0.92
AgentSubsystemTypeAlias · 0.92
NewExecerFunction · 0.92
WaitForReinitLoopFunction · 0.92

Tested by

no test coverage detected