From d2191eb1c07e5366c0e486c94b05e2cb3cc755f4 Mon Sep 17 00:00:00 2001 From: Valtteri Vuorikoski Date: Fri, 17 Jul 2020 17:07:06 +0300 Subject: Allow customizing puppeteer headless & proxy with env. --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 1d2a8f4..3fd1d00 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,10 @@ const responseHeadersToRemove = ["Accept-Ranges", "Content-Length", "Keep-Alive" }; if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) options.executablePath = '/usr/bin/chromium-browser'; + if (process.env.PUPPETEER_HEADFUL) + options.headless = false; + if (process.env.PUPPETEER_PROXY) + options.args.push(`--proxy-server=${process.env.PUPPETEER_PROXY}`); const browser = await puppeteer.launch(options); app.use(async ctx => { if (ctx.query.url) { -- cgit v1.2.3