From f830dfcf15d23e63979aadab6e094e92719e29fe Mon Sep 17 00:00:00 2001 From: Emilien Devos Date: Fri, 22 May 2020 20:30:54 +0200 Subject: allow it to work without docker --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index bc19d1a..75fe2ec 100644 --- a/index.js +++ b/index.js @@ -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(); -- cgit v1.2.3