-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunLocal.js
More file actions
44 lines (35 loc) · 941 Bytes
/
Copy pathrunLocal.js
File metadata and controls
44 lines (35 loc) · 941 Bytes
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
35
36
37
38
39
40
41
42
43
44
const ProxyMaster = require('./src/proxy/master')
const ProxyWorker = require('./src/proxy/worker')
const log = require('./src/logging')
const MASTER_PORT = 3000
const PUBLIC_HTTP_PORT = 2000
const MASTER_HOST = 'localhost'
const WORKER_PORT = 4000
;(async () => {
let config = {
PRIVATE_HOST: process.argv[3],
PUBLIC_PORT: PUBLIC_HTTP_PORT,
PRIVATE_PORT: MASTER_PORT
}
const proxyMaster = new ProxyMaster(config)
;(async () => {
try {
await proxyMaster.run()
} catch (e) {
log.error(`FATAL: Proxy master failed with ${e.stack}`)
process.exit(1)
}
})()
log.info('Starting up proxy node.')
config = {
PUBLIC_HOST: 'localhost',
PORT: WORKER_PORT,
MASTER_HOST: MASTER_HOST,
MASTER_PORT: MASTER_PORT
}
const proxyWorker = new ProxyWorker(config)
await proxyWorker.run()
})().catch(e => {
log.error(`FATAL: Run local error: ${e.stack}`)
process.exit(1)
})