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

Function startWorkspaceProxy

site/e2e/proxy.ts:5–27  ·  view source on GitHub ↗
(
	token: string,
)

Source from the content-addressed store, hash-verified

3import { waitUntilUrlIsNotResponding } from "./helpers";
4
5export const startWorkspaceProxy = async (
6 token: string,
7): Promise<ChildProcess> => {
8 const cp = spawn(coderBinary, ["wsproxy", "server"], {
9 env: {
10 ...process.env,
11 CODER_PRIMARY_ACCESS_URL: `http://127.0.0.1:${coderPort}`,
12 CODER_PROXY_SESSION_TOKEN: token,
13 CODER_HTTP_ADDRESS: `localhost:${workspaceProxyPort}`,
14 },
15 });
16 cp.stdout.on("data", (data: Buffer) => {
17 console.info(
18 `[wsproxy] [stdout] [onData] ${data.toString().replace(/\n$/g, "")}`,
19 );
20 });
21 cp.stderr.on("data", (data: Buffer) => {
22 console.info(
23 `[wsproxy] [stderr] [onData] ${data.toString().replace(/\n$/g, "")}`,
24 );
25 });
26 return cp;
27};
28
29export const stopWorkspaceProxy = async (cp: ChildProcess) => {
30 exec(`kill ${cp.pid}`, (error) => {

Callers 1

Calls 1

infoMethod · 0.80

Tested by

no test coverage detected