diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-07-18 15:24:37 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-07-18 15:24:37 -0500 |
commit | 1d00f3b9840003601175d5394af34b29222db4e3 (patch) | |
tree | f835e910d5f11b84ce2403e307caea080c34ab79 /scripts | |
parent | de87ec17d1673855fdfe2ccd125d734591969dd4 (diff) | |
download | voidsky-1d00f3b9840003601175d5394af34b29222db4e3.tar.zst |
Add mock API and reorg code for clarity
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/testing-server.mjs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/testing-server.mjs b/scripts/testing-server.mjs index adc214cf9..f3c68e535 100644 --- a/scripts/testing-server.mjs +++ b/scripts/testing-server.mjs @@ -2,8 +2,11 @@ import {IpldStore} from '@adxp/common' import PDSServer from '@adxp/server/dist/server.js' import PDSDatabase from '@adxp/server/dist/db/index.js' import WSRelayServer from '@adxp/ws-relay/dist/index.js' +import AuthLobbyServer from '@adxp/auth-lobby' const PDS_PORT = 2583 +const AUTH_LOBBY1_PORT = 3001 +const AUTH_LOBBY2_PORT = 3002 const WSR_PORT = 3005 async function start() { @@ -15,11 +18,19 @@ async function start() { await db.createTables() PDSServer(serverBlockstore, db, PDS_PORT) + init(AuthLobbyServer, AUTH_LOBBY1_PORT, 'Auth lobby') + if (process.argv.includes('--relay')) { - WSRelayServer(WSR_PORT) - console.log(`🔁 Relay server running on port ${WSR_PORT}`) + init(AuthLobbyServer, AUTH_LOBBY2_PORT, 'Auth lobby 2') + init(WSRelayServer, WSR_PORT, 'Relay server') } else { - console.log('Include --relay to start the WS Relay') + console.log('Include --relay to start the WS Relay and second auth lobby') } } start() + +function init(fn, port, name) { + const s = fn(port) + s.on('listening', () => console.log(`✔ ${name} running on port ${port}`)) + s.on('error', e => console.log(`${name} failed to start:`, e)) +} |