MCPcopy Create free account
hub / github.com/cloudflare/computer / parsePort

Function parsePort

packages/computerd/src/cli/computerd.ts:67–78  ·  view source on GitHub ↗
(value: string | undefined)

Source from the content-addressed store, hash-verified

65}
66
67function parsePort(value: string | undefined): number {
68 if (value === undefined || value === "") {
69 return DEFAULT_PORT;
70 }
71
72 const port = Number(value);
73 if (!Number.isInteger(port) || port < 0 || port > 65_535) {
74 throw new Error(`PORT must be an integer between 0 and 65535, got ${JSON.stringify(value)}`);
75 }
76
77 return port;
78}
79
80function parseMountPoint(value: string | undefined): string {
81 const mountPoint = value === undefined || value === "" ? DEFAULT_MOUNT_POINT : value;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected