| 14 | const __dirname = dirname(fileURLToPath(import.meta.url)); |
| 15 | |
| 16 | const 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 | |
| 26 | const PORT = parsePort(process.env.CLOUD_TEST_DB_PORT); |
| 27 | const MIGRATIONS_FOLDER = resolve(__dirname, "../drizzle"); |