MCPcopy
hub / github.com/coder/mux / buildRuntimeConfig

Function buildRuntimeConfig

src/common/types/runtime.ts:219–246  ·  view source on GitHub ↗
(parsed: ParsedRuntime)

Source from the content-addressed store, hash-verified

217 * in string serialization via buildRuntimeString + parseRuntimeString.
218 */
219export function buildRuntimeConfig(parsed: ParsedRuntime): RuntimeConfig | undefined {
220 switch (parsed.mode) {
221 case RUNTIME_MODE.SSH:
222 return {
223 type: RUNTIME_MODE.SSH,
224 host: parsed.host.trim(),
225 srcBaseDir: "~/mux", // Default remote base directory (tilde resolved by backend)
226 coder: parsed.coder,
227 };
228 case RUNTIME_MODE.DOCKER:
229 return {
230 type: RUNTIME_MODE.DOCKER,
231 image: parsed.image.trim(),
232 shareCredentials: parsed.shareCredentials,
233 };
234 case RUNTIME_MODE.LOCAL:
235 return { type: RUNTIME_MODE.LOCAL };
236 case RUNTIME_MODE.DEVCONTAINER:
237 return {
238 type: RUNTIME_MODE.DEVCONTAINER,
239 configPath: parsed.configPath.trim(),
240 shareCredentials: parsed.shareCredentials,
241 };
242 case RUNTIME_MODE.WORKTREE:
243 // Worktree uses system default config
244 return undefined;
245 }
246}
247
248/**
249 * Type guard to check if a runtime config is SSH

Callers 1

useCreationWorkspaceFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected