diff options
author | Emilien Devos <contact@emiliendevos.be> | 2020-05-22 20:30:54 +0200 |
---|---|---|
committer | Emilien Devos <contact@emiliendevos.be> | 2020-05-22 20:30:54 +0200 |
commit | f830dfcf15d23e63979aadab6e094e92719e29fe (patch) | |
tree | 9fffb1660c6c80b3c9354905f1e7e5caa423c74c | |
parent | a01f18a11034408c251a8326c8df84157aae9761 (diff) |
allow it to work without docker
-rw-r--r-- | index.js | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -5,11 +5,13 @@ const Koa = require('koa'); const app = new Koa(); (async () => { - const browser = await puppeteer.launch({ + let options = { headless: true, - executablePath: '/usr/bin/chromium-browser', args: ['--no-sandbox', '--disable-setuid-sandbox'] - }); + }; + if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) + options.executablePath = '/usr/bin/chromium-browser'; + const browser = await puppeteer.launch(options); app.use(async ctx => { if (ctx.query.url) { const page = await browser.newPage(); |