-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.js
30 lines (24 loc) · 849 Bytes
/
index.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
const ChromeLauncher = require('chrome-launcher')
const Server = require('./lib/server')
const webServer = new Server({
port: process.env.PORT || 5001,
privateToken: process.env.PRIVATE_TOKEN
})
console.log('Starting Google Chrome')
ChromeLauncher.launch({
chromePath: '/usr/bin/chromium-browser',
chromeFlags: ['--headless', '--disable-gpu', '--disable-dev-shm-usage', '--no-sandbox', '--hide-scrollbars'],
port: 9222,
startingUrl: (process.env.STARTING_URL || 'about:blank')
}).then((chrome) => {
console.log(`Chrome debugging port running on ${chrome.port}`)
chrome.process.on('close', (code) => {
console.error(`Chrome process closed with code ${code}`)
process.exit(code)
})
webServer.start()
}).catch((error) => {
console.error(error)
console.error('Exiting')
process.exit(1)
})