aboutsummaryrefslogtreecommitdiffstats
path: root/src/environment.js
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-05-27 20:37:32 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-27 20:37:32 +0200
commit38de1e0cf41b9d5527d405952e2d66e983ca2a5c (patch)
tree0815e4e56dfecbdf1c8775a3954c601031b7a944 /src/environment.js
parentUse electronuserland base image so that we don't need to manually track all s... (diff)
downloadferdium-app-38de1e0cf41b9d5527d405952e2d66e983ca2a5c.tar.gz
ferdium-app-38de1e0cf41b9d5527d405952e2d66e983ca2a5c.tar.zst
ferdium-app-38de1e0cf41b9d5527d405952e2d66e983ca2a5c.zip
Environmental variables for dev/production mode (#1455)
* Restore ELECTRON_IS_DEV environment variable As part of migrating to @electron/remote from electron.remote, 296ce5ce6 removed the electron-is-dev package and with it the support of selecting dev/production mode with the ELECTRON_IS_DEV environmental variable. This commit restores support for this variable. Because even the newest version of the electron-is-dev package breaks in renderer processes, we instead query the environment ourselves. * Add support for NODE_ENV variable Also support NODE_ENV for specifying dev mode in addition to the ELECTRON_IS_DEV variable. This variable is used by e.g., the packaging in Arch Linux to trigger production mode with an explicit electron command line invocation: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ferdi-git&id=61dc59e5eb19a2c9e8f9edaf0a63aaae72990a0b#n109 * Refactor environmental variable handling
Diffstat (limited to 'src/environment.js')
-rw-r--r--src/environment.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/environment.js b/src/environment.js
index 1aa0def04..fb7c9d133 100644
--- a/src/environment.js
+++ b/src/environment.js
@@ -1,4 +1,5 @@
1import { 1import {
2 isDevMode as isDev,
2 LIVE_API, 3 LIVE_API,
3 DEV_API, 4 DEV_API,
4 LOCAL_API, 5 LOCAL_API,
@@ -15,7 +16,9 @@ import {
15// eslint-disable-next-line global-require 16// eslint-disable-next-line global-require
16export const { app } = process.type === 'renderer' ? require('@electron/remote') : require('electron'); 17export const { app } = process.type === 'renderer' ? require('@electron/remote') : require('electron');
17 18
18export const isDevMode = !app.isPackaged; 19// TODO Remove this re-export and move the code from config.js to here.
20export const isDevMode = isDev;
21
19export const useLiveAPI = process.env.LIVE_API; 22export const useLiveAPI = process.env.LIVE_API;
20export const useLocalAPI = process.env.LOCAL_API; 23export const useLocalAPI = process.env.LOCAL_API;
21 24