MCPcopy
hub / github.com/coder/code-server / setup

Function setup

test/utils/integration.ts:9–31  ·  view source on GitHub ↗
(argv: string[], configFile?: string)

Source from the content-addressed store, hash-verified

7import * as httpserver from "./httpserver"
8
9export async function setup(argv: string[], configFile?: string): Promise<httpserver.HttpServer> {
10 // This will be used as the data directory to ensure instances do not bleed
11 // into each other.
12 const dir = await tmpdir(workspaceDir)
13
14 // VS Code complains if the logs dir is missing which spams the output.
15 // TODO: Does that mean we are not creating it when we should be?
16 await fs.mkdir(path.join(dir, "logs"))
17
18 const cliArgs = parse([
19 `--config=${path.join(dir, "config.yaml")}`,
20 `--user-data-dir=${dir}`,
21 "--bind-addr=localhost:0",
22 "--log=warn",
23 ...argv,
24 ])
25 const configArgs = parseConfigFile(configFile || "", "test/integration.ts")
26 const args = await setDefaults(cliArgs, configArgs)
27
28 const server = await runCodeServer(args)
29
30 return new httpserver.HttpServer(server)
31}

Callers

nothing calls this directly

Calls 5

tmpdirFunction · 0.90
parseFunction · 0.90
parseConfigFileFunction · 0.90
setDefaultsFunction · 0.90
runCodeServerFunction · 0.90

Tested by

no test coverage detected