MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / parsePort

Function parsePort

scripts/guardian/prod.mjs:41–47  ·  view source on GitHub ↗
(raw, origin)

Source from the content-addressed store, hash-verified

39// no TS tooling). Broken explicit config fails loud rather than silently
40// falling back; an in-use port fails at bind, also loud.
41function 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
49async function readPortsFile(userDataHome) {
50 const filePath = resolve(userDataHome, 'data', 'config', 'ports.json')

Callers 2

readPortsFileFunction · 0.70
pickPortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected