Configuration
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 variable 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 defined 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. This command does not run directly from the command line (terminal). Instead, to set build-time environment variables, we need to add a script to package.json
with the following format:
"[build|dev]:<script name>": "dotenv -e env/<your env file> npm run [build|dev]"
Honeycomb includes so scripts for common scenarios. For instance, you can run:
npm run dev:home
npm run dev:home:video
npm run dev:clinic
npm run dev:clinic:video
npm run dev:firebase