(raw, origin)
| 39 | // no TS tooling). Broken explicit config fails loud rather than silently |
| 40 | // falling back; an in-use port fails at bind, also loud. |
| 41 | function parsePort(raw, origin) { |
| 42 | const n = typeof raw === 'number' ? raw : Number(raw) |
| 43 | if (!Number.isInteger(n) || n < 1 || n > 65535) { |
| 44 | throw new Error(`[guardian/prod] invalid port ${JSON.stringify(raw)} from ${origin} — expected an integer in 1..65535`) |
| 45 | } |
| 46 | return n |
| 47 | } |
| 48 | |
| 49 | async function readPortsFile(userDataHome) { |
| 50 | const filePath = resolve(userDataHome, 'data', 'config', 'ports.json') |
no outgoing calls
no test coverage detected