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

Function setupWorkspaceProxy

scripts/develop/main.go:1001–1022  ·  view source on GitHub ↗
(ctx context.Context, cfg *devConfig, client *codersdk.Client, group *procGroup)

Source from the content-addressed store, hash-verified

999}
1000
1001func setupWorkspaceProxy(ctx context.Context, cfg *devConfig, client *codersdk.Client, group *procGroup) error {
1002 _ = client.DeleteWorkspaceProxyByName(ctx, "local-proxy")
1003
1004 resp, err := client.CreateWorkspaceProxy(ctx,
1005 codersdk.CreateWorkspaceProxyRequest{
1006 Name: "local-proxy",
1007 DisplayName: "Local Proxy",
1008 Icon: "/emojis/1f4bb.png",
1009 })
1010 if err != nil {
1011 return xerrors.Errorf("creating proxy: %w", err)
1012 }
1013
1014 cmd := cfg.cmd(ctx, cfg.binaryPath,
1015 "--global-config", cfg.configDir,
1016 "wsproxy", "server",
1017 "--dangerous-allow-cors-requests=true",
1018 "--http-address", fmt.Sprintf("localhost:%d", cfg.proxyPort),
1019 "--proxy-session-token", resp.ProxyToken,
1020 "--primary-access-url", fmt.Sprintf("http://localhost:%d", cfg.apiPort))
1021 return group.Start("proxy", cmd)
1022}
1023
1024// setupStarterTemplate creates a template from a starter example.
1025// For starters tagged with "docker", it checks Docker availability

Callers 1

developFunction · 0.85

Calls 5

CreateWorkspaceProxyMethod · 0.80
cmdMethod · 0.80
StartMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected