forked from synonymdev/slashtag-seeding-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbin.js
34 lines (26 loc) · 798 Bytes
/
bin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env node
const config = require('config')
const { SeedingServer } = require('.')
const App = require('./src/app.js')
const path = require('path')
main()
async function main() {
const opts = {
dbName: config.get('store.dbName')
}
const storage = config.get('store.path');
opts.storage = storage && path.join(__dirname, storage)
try {
opts.topic = Buffer.from(config.get('slashtags.topicKey'), 'hex')
} catch {
throw new Error('Must set See slashtags.topicKey in config')
}
try {
opts.seed = Buffer.from(config.get('slashtags.seed'), 'hex')
} catch { }
// Create the slashtag seeding server
const server = new SeedingServer(opts)
// Setup HTTP server over the same seeding instance
const app = new App(server.seeder)
await app.start()
}