Switches de Linha de Comando Suportadas
Opções de linha de comando suportados pelo Electron.
You can use app.commandLine.appendSwitch to append them in your app's main script before the ready event of the app module is emitted:
const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
app.whenReady().then(() => {
// Your code here
})
Electron CLI Flags
--auth-server-whitelist=url
A comma-separated list of servers for which integrated authentication is enabled.
Como por exemplo:
--auth-server-whitelist='*example.com, *foobar.com, *baz'
then any url
ending with example.com
, foobar.com
, baz
will be considered for integrated authentication. Without *
prefix the URL has to match exactly.
--auth-negotiate-delegate-whitelist=url
A comma-separated list of servers for which delegation of user credentials is required. Without *
prefix the URL has to match exactly.
--disable-ntlm-v2
Disables NTLM v2 for posix platforms, no effect elsewhere.
--disable-http-cache
Desabilita o cache de disco para as requisições HTTP.
--disable-http2
Disable HTTP/2 and SPDY/3.1 protocols.
--disable-renderer-backgrounding
Prevents Chromium from lowering the priority of invisible pages' renderer processes.
This flag is global to all renderer processes, if you only want to disable throttling in one window, you can take the hack of playing silent audio.
--disk-cache-size=size
Força o máximo de espaço em disco a ser usado pelo cache de disco, em bytes.
--enable-logging[=file]
Prints Chromium's logging to stderr (or a log file).
The ELECTRON_ENABLE_LOGGING
environment variable has the same effect as passing --enable-logging
.
Passing --enable-logging
will result in logs being printed on stderr. Passing --enable-logging=file
will result in logs being saved to the file specified by --log-file=...
, or to electron_debug.log
in the user-data directory if --log-file
is not specified.
Note: On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.
See also --log-file
, --log-level
, --v
, and --vmodule
.
--force-fieldtrials=trials
Field trials to be forcefully enabled or disabled.
Por exemplo: WebRTC-Audio-Red-For-Opus/Enabled/
--host-rules=rules
A comma-separated list of rules
that control how hostnames are mapped.
Como por exemplo:
MAP * 127.0.0.1
Forces all hostnames to be mapped to 127.0.0.1MAP *.google.com proxy
Forces all google.com subdomains to be resolved to "proxy".MAP test.com [::1]:77
Forces "test.com" to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.MAP * baz, EXCLUDE www.google.com
Remaps everything to "baz", except for "www.google.com".
These mappings apply to the endpoint host in a net request (the TCP connect and host resolver in a direct connection, and the CONNECT
in an HTTP proxy connection, and the endpoint host in a SOCKS
proxy connection).
--host-resolver-rules=rules
Like --host-rules
but these rules
only apply to the host resolver.
--ignore-certificate-errors
Ignores certificate related errors.
--ignore-connections-limit=domains
Ignora o limite de conexão por domains
lista separada por ,
.
--js-flags=flags
Specifies the flags passed to the V8 engine. In order to enable the flags
in the main process, this switch must be passed on startup.
$ electron --js-flags="--harmony_proxies --harmony_collections" seu-app
Run node --v8-options
or electron --js-flags="--help"
in your terminal for the list of available flags. These can be used to enable early-stage JavaScript features, or log and manipulate garbage collection, among other things.
For example, to trace V8 optimization and deoptimization:
$ electron --js-flags="--trace-opt --trace-deopt" your-app
--lang
Definir uma localidade customizada.
--log-file=path
If --enable-logging
is specified, logs will be written to the given path. The parent directory must exist.
Setting the ELECTRON_LOG_FILE
environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.
--log-net-log=path
Enables net log events to be saved and writes them to path
.
--log-level=N
Sets the verbosity of logging when used together with --enable-logging
. N
should be one of Chrome's LogSeverities.
Note that two complimentary logging mechanisms in Chromium -- LOG()
and VLOG()
-- are controlled by different switches. --log-level
controls LOG()
messages, while --v
and --vmodule
control VLOG()
messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.
See Chromium Logging source for more information on how LOG()
and VLOG()
interact. Loosely speaking, VLOG()
can be thought of as sub-levels / per-module levels inside LOG(INFO)
to control the firehose of LOG(INFO)
data.
See also --enable-logging
, --log-level
, --v
, and --vmodule
.
--no-proxy-server
Don't use a proxy server and always make direct connections. Overrides any other proxy server flags that are passed.
--no-sandbox
Disables the Chromium sandbox. Forces renderer process and Chromium helper processes to run un-sandboxed. Should only be used for testing.
--proxy-bypass-list=hosts
Instructs Electron to bypass the proxy server for the given semi-colon-separated list of hosts. This flag has an effect only if used in tandem with --proxy-server
.
Como por exemplo:
const { app } = require('electron')
app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')
Will use the proxy server for all hosts except for local addresses (localhost
, 127.0.0.1
etc.), google.com
subdomains, hosts that contain the suffix foo.com
and anything at 1.2.3.4:5678
.
--proxy-pac-url=url
Uses the PAC script at the specified url
.
--proxy-server=address:port
Use a specified proxy server, which overrides the system setting. This switch only affects requests with HTTP protocol, including HTTPS and WebSocket requests. It is also noteworthy that not all proxy servers support HTTPS and WebSocket requests. The proxy URL does not support username and password authentication per Chromium issue.
--remote-debugging-port=port
Habilita depuração remota sobre o HTTP na port
especificada.
--v=log_level
Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.
This switch only works when --enable-logging
is also passed.
See also --enable-logging
, --log-level
, and --vmodule
.