In this section, we will learn Electron
the environment variables in 060b8e06d57877. Environment variables are mainly used to control application configuration and behavior without changing the code. Certain Electron
behaviors are controlled by it, so they are initialized earlier than the command line flags and application code.
We can divide environment variables into two types: production environment-related variables and development environment-related variables.
Production environment related variables
Variables related to the production environment are often used when the packaged Electron
application is running. There are the following:
NODE_OPTIONS
:Electron
includes support forNode
NODE_OPTIONS
. Most of them are supported except for theChromium
usingBoringSSL
GOOGLE_API_KEY
:Electron
contains a hard-codedAPI
password that is used to send requestsweb
ELECTRON_NO_ASAR
: DisableASAR
support. This variable is only supported in the derived child process and derived child process ofset
ELECTRON_RUN_AS_NODE
: Start as a normalNode.js
process. In this mode, we can pass thecli
Node.js
Node.js
executable file, except for the following flags:
--openssl-config
--use-bundled-ca
--use-openssl-ca
--force-fips
--enable-fips
ELECTRON_NO_ATTACH_CONSOLE
: Do not attach to the current console session.ELECTRON_FORCE_WINDOW_MENU_BAR
: Do not use the global menu barLinux
ELECTRON_TRASH
: Set the garbage collection implementationLinux
gio
.
Development environment related variables
Development environment related variables are often used for development and debugging purposes. There are the following:
ELECTRON_ENABLE_LOGGING
:Chrome
the internal log records of 060b8e06d57a8b to the console.ELECTRON_LOG_ASAR_READS
: WhenElectron
read from theASAR
file, we need to read the offset and file path record to the systemtimdir
. Provide the result file to theASAR
module to optimize the file sorting.ELECTRON_ENABLE_STACK_DUMPING
: WhenElectron
crashes, print the stack trace to the console. IfcrashReporter
has been started, this environment variable will not work.ELECTRON_DEFAULT_ERROR_MODE
: WhenELectron
show crashWindows
crash dialog. IfcrashReporter
has been started, this environment variable will not work.ELECTRON_OVERRIDE_DIST_PATH
: When theelectron
package runs, this variable tells theelectron
command to use the buildElectron
instead of the build downloadednpm install
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。