Adding CLI options: port shift and unsafe expose. (#5677)
* Adding CLI option for port shift and unsafe expose. * Fixing IPC path. * Fix hosts when attempting to expose on all interfaces. * Fixing test. * Fix typo.
This commit is contained in:
committed by
Arkadiy Paronyan
parent
532801f9d6
commit
f47cbe0be6
@@ -81,3 +81,5 @@ jit = false
|
||||
logging = "own_tx=trace"
|
||||
log_file = "/var/log/parity.log"
|
||||
color = true
|
||||
ports_shift = 0
|
||||
unsafe_expose = false
|
||||
|
||||
@@ -98,6 +98,13 @@ usage! {
|
||||
flag_no_persistent_txqueue: bool = false,
|
||||
or |c: &Config| otry!(c.parity).no_persistent_txqueue,
|
||||
|
||||
// -- Convenience Options
|
||||
flag_config: String = "$BASE/config.toml", or |_| None,
|
||||
flag_ports_shift: u16 = 0u16,
|
||||
or |c: &Config| otry!(c.misc).ports_shift,
|
||||
flag_unsafe_expose: bool = false,
|
||||
or |c: &Config| otry!(c.misc).unsafe_expose,
|
||||
|
||||
// -- Account Options
|
||||
flag_unlock: Option<String> = None,
|
||||
or |c: &Config| otry!(c.account).unlock.as_ref().map(|vec| Some(vec.join(","))),
|
||||
@@ -189,7 +196,7 @@ usage! {
|
||||
// IPC
|
||||
flag_no_ipc: bool = false,
|
||||
or |c: &Config| otry!(c.ipc).disable.clone(),
|
||||
flag_ipc_path: String = "$BASE/jsonrpc.ipc",
|
||||
flag_ipc_path: String = if cfg!(windows) { r"\\.\pipe\jsonrpc.ipc" } else { "$BASE/jsonrpc.ipc" },
|
||||
or |c: &Config| otry!(c.ipc).path.clone(),
|
||||
flag_ipc_apis: String = "web3,eth,net,parity,parity_accounts,traces,rpc,secretstore",
|
||||
or |c: &Config| otry!(c.ipc).apis.as_ref().map(|vec| vec.join(",")),
|
||||
@@ -339,7 +346,6 @@ usage! {
|
||||
or |c: &Config| otry!(c.vm).jit.clone(),
|
||||
|
||||
// -- Miscellaneous Options
|
||||
flag_config: String = "$BASE/config.toml", or |_| None,
|
||||
flag_logging: Option<String> = None,
|
||||
or |c: &Config| otry!(c.misc).logging.clone().map(Some),
|
||||
flag_log_file: Option<String> = None,
|
||||
@@ -575,6 +581,8 @@ struct Misc {
|
||||
logging: Option<String>,
|
||||
log_file: Option<String>,
|
||||
color: Option<bool>,
|
||||
ports_shift: Option<u16>,
|
||||
unsafe_expose: Option<bool>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -686,6 +694,11 @@ mod tests {
|
||||
flag_light: false,
|
||||
flag_no_persistent_txqueue: false,
|
||||
|
||||
// -- Convenience Options
|
||||
flag_config: "$BASE/config.toml".into(),
|
||||
flag_ports_shift: 0,
|
||||
flag_unsafe_expose: false,
|
||||
|
||||
// -- Account Options
|
||||
flag_unlock: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
|
||||
flag_password: vec!["~/.safe/password.file".into()],
|
||||
@@ -862,7 +875,6 @@ mod tests {
|
||||
|
||||
// -- Miscellaneous Options
|
||||
flag_version: false,
|
||||
flag_config: "$BASE/config.toml".into(),
|
||||
flag_logging: Some("own_tx=trace".into()),
|
||||
flag_log_file: Some("/var/log/parity.log".into()),
|
||||
flag_no_color: false,
|
||||
@@ -1037,6 +1049,8 @@ mod tests {
|
||||
logging: Some("own_tx=trace".into()),
|
||||
log_file: Some("/var/log/parity.log".into()),
|
||||
color: Some(true),
|
||||
ports_shift: Some(0),
|
||||
unsafe_expose: Some(false),
|
||||
}),
|
||||
stratum: None,
|
||||
});
|
||||
|
||||
@@ -76,6 +76,18 @@ Operating Options:
|
||||
potentially higher in bandwidth. Has no effect with
|
||||
subcommands (default: {flag_light}).
|
||||
|
||||
Convenience Options:
|
||||
-c --config CONFIG Specify a filename containing a configuration file.
|
||||
(default: {flag_config})
|
||||
--ports-shift SHIFT Add SHIFT to all port numbers Parity is listening on.
|
||||
Includes network port and all servers (RPC, WebSockets, UI, IPFS, SecretStore).
|
||||
(default: {flag_ports_shift})
|
||||
--unsafe-expose All servers will listen on external interfaces and will
|
||||
be remotely accessible. It's equivalent with setting
|
||||
the following: --{{ws,jsonrpc,ui,ipfs,secret_store,stratum}}-interface=all --*-hosts=all
|
||||
This option is UNSAFE and should be used with great care!
|
||||
(default: {flag_unsafe_expose})
|
||||
|
||||
Account Options:
|
||||
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
|
||||
ACCOUNTS is a comma-delimited list of addresses.
|
||||
@@ -441,8 +453,6 @@ Internal Options:
|
||||
--can-restart Executable will auto-restart if exiting with 69.
|
||||
|
||||
Miscellaneous Options:
|
||||
-c --config CONFIG Specify a filename containing a configuration file.
|
||||
(default: {flag_config})
|
||||
-l --logging LOGGING Specify the logging level. Must conform to the same
|
||||
format as RUST_LOG. (default: {flag_logging:?})
|
||||
--log-file FILENAME Specify a filename into which logging should be
|
||||
|
||||
Reference in New Issue
Block a user