diff --git a/parity/cli.rs b/parity/cli.rs index 17f1fa5ab..b5d16e92b 100644 --- a/parity/cli.rs +++ b/parity/cli.rs @@ -117,7 +117,9 @@ API and Console Options: [default: $HOME/.parity/dapps] --signer Enable Trusted Signer WebSocket endpoint used by - Signer UIs. + Signer UIs. Default if run with ui command. + --no-signer Disable Trusted Signer WebSocket endpoint used by + Signer UIs. Default if no command is specified. --signer-port PORT Specify the port of Trusted Signer server [default: 8180]. --signer-path PATH Specify directory where Signer UIs tokens should @@ -276,6 +278,7 @@ pub struct Args { pub flag_dapps_pass: Option, pub flag_dapps_path: String, pub flag_signer: bool, + pub flag_no_signer: bool, pub flag_signer_port: u16, pub flag_signer_path: String, pub flag_no_token: bool, diff --git a/parity/configuration.rs b/parity/configuration.rs index f0cbebdb4..d92e50a41 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -441,7 +441,7 @@ impl Configuration { } pub fn signer_port(&self) -> Option { - if !self.args.flag_signer { + if !self.signer_enabled() { None } else { Some(self.args.flag_signer_port) @@ -467,6 +467,11 @@ impl Configuration { pub fn dapps_enabled(&self) -> bool { !self.args.flag_dapps_off && !self.args.flag_no_dapps } + + pub fn signer_enabled(&self) -> bool { + (self.args.cmd_ui && !self.args.flag_no_signer) || + (!self.args.cmd_ui && self.args.flag_signer) + } } #[cfg(test)] diff --git a/parity/main.rs b/parity/main.rs index fd7e8a437..7d39143cb 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -192,14 +192,14 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig) let sync_config = conf.sync_config(&spec); // Create and display a new token for UIs. - if conf.args.flag_signer && !conf.args.flag_no_token { + if conf.signer_enabled() && !conf.args.flag_no_token { new_token(conf.directories().signer).unwrap_or_else(|e| { die!("Error generating token: {:?}", e) }); } // Display warning about using unlock with signer - if conf.args.flag_signer && conf.args.flag_unlock.is_some() { + if conf.signer_enabled() && conf.args.flag_unlock.is_some() { warn!("Using Trusted Signer and --unlock is not recommended!"); warn!("NOTE that Signer will not ask you to confirm transactions from unlocked account."); } @@ -278,7 +278,7 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig) // Set up a signer let signer_server = signer::start(signer::Configuration { - enabled: deps_for_rpc_apis.signer_port.is_some(), + enabled: conf.signer_enabled(), port: conf.args.flag_signer_port, signer_path: conf.directories().signer, }, signer::Dependencies {