(ctx context.Context, cfg *devConfig, client *codersdk.Client, group *procGroup)
| 999 | } |
| 1000 | |
| 1001 | func 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 |
no test coverage detected