I'm building an Electron app using Electron Forge and I need to pass environment variables to the final executable.
I've tried defining the environment variables in forge.config.js
like this:
env: {
DB_PATH_RELATIVE: process.env.DB_PATH_RELATIVE,
DB_CURRENT_VERSION: process.env.DB_CURRENT_VERSION
}
But the environment variables don't seem to be passed to the final executable. I've also tried setting the environment variables using cross-env
in the start
and make
scripts in package.json
, but that doesn't seem to work either, just are accesible from forge.config.js
only seem to be accessible within that file and are not passed to the final executable.
What's the correct way to pass environment variables to the final executable of an Electron Forge app? Any help would be appreciated. Thanks!