electron/docs/api/environment-variables.md

55 lines
1.3 KiB
Markdown
Raw Normal View History

2016-05-17 16:02:54 -07:00
# Environment Variables
2015-11-26 20:37:48 +08:00
2016-04-21 15:39:12 -07:00
> Control application configuration and behavior without changing code.
2016-05-20 14:03:28 -07:00
Certain Electron behaviors are controlled by environment variables because they
are initialized earlier than the command line flags and the app's code.
2015-11-26 20:37:48 +08:00
2016-05-20 14:03:56 -07:00
POSIX shell example:
2015-11-26 20:44:07 +08:00
```bash
$ export ELECTRON_ENABLE_LOGGING=true
$ electron
```
2016-05-20 14:03:56 -07:00
Windows console example:
2015-11-26 20:44:07 +08:00
```powershell
> set ELECTRON_ENABLE_LOGGING=true
> electron
```
2016-05-20 13:58:48 -07:00
### `ELECTRON_RUN_AS_NODE`
2015-11-26 20:37:48 +08:00
Starts the process as a normal Node.js process.
2016-05-20 13:58:48 -07:00
### `ELECTRON_ENABLE_LOGGING`
2015-11-26 20:37:48 +08:00
2016-05-20 14:01:08 -07:00
Prints Chrome's internal logging to the console.
2015-11-26 20:37:48 +08:00
2016-05-20 13:58:48 -07:00
### `ELECTRON_LOG_ASAR_READS`
2016-01-21 10:57:50 -08:00
When Electron reads from an ASAR file, log the read offset and file path to
the system `tmpdir`. The resulting file can be provided to the ASAR module
to optimize file ordering.
2016-05-20 13:58:48 -07:00
### `ELECTRON_ENABLE_STACK_DUMPING`
2015-11-26 20:37:48 +08:00
2016-05-20 14:02:10 -07:00
Prints the stack trace to the console when Electron crashes.
2015-11-26 20:37:48 +08:00
2016-05-20 14:01:08 -07:00
This environment variable will not work if the `crashReporter` is started.
2015-11-26 20:37:48 +08:00
2016-05-20 13:58:48 -07:00
### `ELECTRON_DEFAULT_ERROR_MODE` _Windows_
2015-11-26 20:37:48 +08:00
2016-05-20 14:01:08 -07:00
Shows the Windows's crash dialog when Electron crashes.
2015-11-26 20:37:48 +08:00
2016-05-20 14:01:08 -07:00
This environment variable will not work if the `crashReporter` is started.
2015-11-26 20:37:48 +08:00
2016-05-20 13:58:48 -07:00
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
2016-05-20 14:01:08 -07:00
Don't attach to the current console session.
2016-05-20 13:58:48 -07:00
### `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_
2015-11-26 20:37:48 +08:00
2016-05-20 14:01:08 -07:00
Don't use the global menu bar on Linux.