MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parsePort

Function parsePort

apps/cloud/scripts/test-globalsetup.ts:21–29  ·  view source on GitHub ↗
(input: string | undefined)

Source from the content-addressed store, hash-verified

19// real port. Fixed ports must stay below 32768: the Linux ephemeral range
20// (32768-60999) is contested by every concurrent suite's outbound sockets.
21const parsePort = (input: string | undefined): number => {
22 if (input === undefined) return 5434;
23 if (!/^\d+$/.test(input)) throw new Error("CLOUD_TEST_DB_PORT must be an integer");
24 const port = Number(input);
25 if (!Number.isSafeInteger(port) || port > 65_535) {
26 throw new Error("CLOUD_TEST_DB_PORT must be between 0 and 65535");
27 }
28 return port;
29};
30
31const PORT = parsePort(process.env.CLOUD_TEST_DB_PORT);
32const MIGRATIONS_FOLDER = resolve(__dirname, "../drizzle");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected