diff options
| -rw-r--r-- | src/handlers/index.js | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/src/handlers/index.js b/src/handlers/index.js index d4eaf43..e6f84df 100644 --- a/src/handlers/index.js +++ b/src/handlers/index.js @@ -5,7 +5,10 @@ const launchUserSession = require('./launchUserSession.js');  const attendConference = require('./attendConference.js');  const { clickElementBySelector } = require('./utils.js'); -const { EDUFPMI_URL } = process.env; +const { EDUFPMI_URL, NODE_ENV, HEADLESS } = process.env; + +// Always run headless in production, but allow configuring for development +const headless = NODE_ENV === 'production' || HEADLESS || false;  const handleJobAsUser = async (job, user) => { @@ -14,7 +17,7 @@ const handleJobAsUser = async (job, user) => {    const { conferenceId } = job.attrs.data;    const conferenceUrl = `${EDUFPMI_URL}/mod/bigbluebuttonbn/view.php?id=${conferenceId}`; -  const browser = await launchUserSession(user, false); +  const browser = await launchUserSession(user, headless);    const page = await browser.newPage();    await page.goto(conferenceUrl); | 
