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

Function parsePort

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

Source from the content-addressed store, hash-verified

14const __dirname = dirname(fileURLToPath(import.meta.url));
15
16const parsePort = (input: string | undefined): number => {
17 if (input === undefined) return 5434;
18 if (!/^\d+$/.test(input)) throw new Error("CLOUD_TEST_DB_PORT must be an integer");
19 const port = Number(input);
20 if (!Number.isSafeInteger(port) || port < 1 || port > 65_535) {
21 throw new Error("CLOUD_TEST_DB_PORT must be between 1 and 65535");
22 }
23 return port;
24};
25
26const PORT = parsePort(process.env.CLOUD_TEST_DB_PORT);
27const MIGRATIONS_FOLDER = resolve(__dirname, "../drizzle");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected