2022-06-14 21:29:47 +02:00
|
|
|
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'
|
2022-06-10 18:55:09 +02:00
|
|
|
|
2022-06-14 21:29:47 +02:00
|
|
|
const PDS_PORT = 2583
|
|
|
|
const WSR_PORT = 3005
|
2022-06-10 18:55:09 +02:00
|
|
|
|
|
|
|
async function start() {
|
|
|
|
console.log('Initializing...')
|
|
|
|
|
2022-06-14 21:29:47 +02:00
|
|
|
const db = PDSDatabase.memory()
|
2022-06-10 18:55:09 +02:00
|
|
|
const serverBlockstore = IpldStore.createInMemory()
|
|
|
|
await db.dropTables()
|
|
|
|
await db.createTables()
|
2022-06-14 21:29:47 +02:00
|
|
|
PDSServer(serverBlockstore, db, PDS_PORT)
|
|
|
|
|
|
|
|
if (process.argv.includes('--relay')) {
|
|
|
|
WSRelayServer(WSR_PORT)
|
|
|
|
console.log(`🔁 Relay server running on port ${WSR_PORT}`)
|
|
|
|
} else {
|
|
|
|
console.log('Include --relay to start the WS Relay')
|
|
|
|
}
|
2022-06-10 18:55:09 +02:00
|
|
|
}
|
|
|
|
start()
|