Environment Variables
Honeycomb uses environment variables during build and run time to control the different configurations. Below we list the environment variables used by the app and indicate their properties via badges and text. Optional variables are labeled with the badge and mandatory variables are labeled with the badge with their default value specified. The badge indicates the variable is used during the build/compilation phase (npm build
) while the badge indicates the variable is used during the executable run (npm run dev
).
Dev Mode Only
ELECTRON_START_URL
: URL (e.g.http://localhost:3000
) where the front end of the app is being hosted - also used inelectron.js
to indicate the app is running in dev mode.
Desktop Only
EVENT_MARKER_PRODUCT_ID
: The product ID of the event marker (e.g.0487
). If not set, it will use theproductID
set inpublic/config/trigger.js
if available, or attempt to connect using the com name.EVENT_MARKER_COM_NAME
: The com name of the event marker (e.g.COM3
). If not set, it will use thecomName
set inpublic/config/trigger.js
. If theproductID
is set (not an empty string), this field will be ignored.REACT_APP_VIDEO
: whether the participant is being video recorded. This can be used when the task is running as a desktop app (electron).REACT_APP_USE_EEG
: whether the event marker/EEG is available. This can be used when the task is running as a desktop app (electron).REACT_APP_USE_PHOTODIODE
: whether the photodiode is in use. This can be used when the task is running as a desktop app (electron).
Desktop and Online
REACT_APP_VOLUME
: whether the participant is being asked to adjust volume. This can be used on both the desktop (electron) and online settings.REACT_APP_PARTICIPANT_ID
: The default participant id to show when authorizing a participant. If not set, user will need to enter the value in the provided input box.REACT_APP_STUDY_ID
: The default study id to show when authorizing a participant. If not set, user will need to enter the value in the provided input box.
Understanding Build-Time and Run-Time Variables
-
: Run-time environment variables allow for quick changes before running the task. They are convenient since they don't require building a whole different executable. For a Desktop Application, these are set at the system level and must be available at the time where the task runs. See this tutorial for OS specific instructions.. For a Firebase Application, these must be stored in the Firestore.
-
: Build-time environment variables are configured before the application is built and cannot be changed at run-time. They are configured via
.env
files before building. Instead of using a single.env
file, we prefer to define separate files under theenv/
directory, and use a package calleddotenv-cli
before building`.
The dotenv-cli
comes with the dotenv
command that can be used to properly load the needed variables. We write our npm scripts with the following format:
"[build|dev]:<env name>": "dotenv -e env/<env name> npm run [build|dev]:<env name>"
See NPM Scripts for more