Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Adding CLI options: port shift and unsafe expose. #5677

Merged
merged 5 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ethcore/src/snapshot/tests/proof_of_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const TRANSITION_BLOCK_1: usize = 2; // block at which the contract becomes acti
const TRANSITION_BLOCK_2: usize = 6; // block at which the second contract activates.

macro_rules! secret {
($e: expr) => { Secret::from_slice(&$e.sha3()).expect(format!("sha3({}) not valid secret.", $e).as_str()) }
($e: expr) => { Secret::from_slice(&$e.sha3()) }
}

lazy_static! {
Expand Down
2 changes: 2 additions & 0 deletions parity/cli/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ jit = false
logging = "own_tx=trace"
log_file = "/var/log/parity.log"
color = true
ports_shift = 0
unsafe_expose = false
20 changes: 17 additions & 3 deletions parity/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(","))),
Expand Down Expand Up @@ -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(",")),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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()],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
});
Expand Down
14 changes: 12 additions & 2 deletions parity/cli/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 equivallent with setting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: equivalent

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.
Expand Down Expand Up @@ -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
Expand Down
Loading