summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-11-14 18:08:26 +0300
committereug-vs <eug-vs@keemail.me>2020-11-14 18:08:26 +0300
commitfb8cdd4bce1c549135b435473b5ca30e77efa969 (patch)
treec6e1507ee111811d1d2c958fd3feba884650b27f
parentecb98e114bc461f439386ed8d914e4617746570d (diff)
downloadbsu-fantom-fb8cdd4bce1c549135b435473b5ca30e77efa969.tar.gz
feat: configure headless mode
-rw-r--r--src/handlers/index.js7
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);