electron/docs/api/environment-variables.md

55 lines
1.3 KiB
Markdown
Raw Normal View History

2016-05-17 23:02:54 +00:00
# Environment Variables
2015-11-26 12:37:48 +00:00
2016-04-21 22:39:12 +00:00
> Control application configuration and behavior without changing code.
2016-05-20 21:03:28 +00: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 12:37:48 +00:00
2015-11-26 12:44:07 +00:00
Examples on POSIX shells:
```bash
$ export ELECTRON_ENABLE_LOGGING=true
$ electron
```
on Windows console:
```powershell
> set ELECTRON_ENABLE_LOGGING=true
> electron
```
2016-05-20 20:58:48 +00:00
### `ELECTRON_RUN_AS_NODE`
2015-11-26 12:37:48 +00:00
Starts the process as a normal Node.js process.
2016-05-20 20:58:48 +00:00
### `ELECTRON_ENABLE_LOGGING`
2015-11-26 12:37:48 +00:00
2016-05-20 21:01:08 +00:00
Prints Chrome's internal logging to the console.
2015-11-26 12:37:48 +00:00
2016-05-20 20:58:48 +00:00
### `ELECTRON_LOG_ASAR_READS`
2016-01-21 18:57:50 +00: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 20:58:48 +00:00
### `ELECTRON_ENABLE_STACK_DUMPING`
2015-11-26 12:37:48 +00:00
2016-05-20 21:02:10 +00:00
Prints the stack trace to the console when Electron crashes.
2015-11-26 12:37:48 +00:00
2016-05-20 21:01:08 +00:00
This environment variable will not work if the `crashReporter` is started.
2015-11-26 12:37:48 +00:00
2016-05-20 20:58:48 +00:00
### `ELECTRON_DEFAULT_ERROR_MODE` _Windows_
2015-11-26 12:37:48 +00:00
2016-05-20 21:01:08 +00:00
Shows the Windows's crash dialog when Electron crashes.
2015-11-26 12:37:48 +00:00
2016-05-20 21:01:08 +00:00
This environment variable will not work if the `crashReporter` is started.
2015-11-26 12:37:48 +00:00
2016-05-20 20:58:48 +00:00
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
2016-05-20 21:01:08 +00:00
Don't attach to the current console session.
2016-05-20 20:58:48 +00:00
### `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_
2015-11-26 12:37:48 +00:00
2016-05-20 21:01:08 +00:00
Don't use the global menu bar on Linux.