Rename cli and config options signer->ui (#3232)
* rename options signer->ui * rename config signer->ui
This commit is contained in:
parent
01602ec0b5
commit
52ea597d6f
@ -12,7 +12,7 @@ unlock = ["0xdeadbeefcafe0000000000000000000000000000"]
|
|||||||
password = ["~/.safe/password.file"]
|
password = ["~/.safe/password.file"]
|
||||||
keys_iterations = 10240
|
keys_iterations = 10240
|
||||||
|
|
||||||
[signer]
|
[ui]
|
||||||
force = false
|
force = false
|
||||||
disable = false
|
disable = false
|
||||||
port = 8180
|
port = 8180
|
||||||
|
@ -8,7 +8,7 @@ chain = "./chain.json"
|
|||||||
unlock = ["0x1", "0x2", "0x3"]
|
unlock = ["0x1", "0x2", "0x3"]
|
||||||
password = ["passwdfile path"]
|
password = ["passwdfile path"]
|
||||||
|
|
||||||
[signer]
|
[ui]
|
||||||
disable = true
|
disable = true
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
|
@ -90,18 +90,18 @@ usage! {
|
|||||||
flag_keys_iterations: u32 = 10240u32,
|
flag_keys_iterations: u32 = 10240u32,
|
||||||
or |c: &Config| otry!(c.account).keys_iterations.clone(),
|
or |c: &Config| otry!(c.account).keys_iterations.clone(),
|
||||||
|
|
||||||
flag_force_signer: bool = false,
|
flag_force_ui: bool = false,
|
||||||
or |c: &Config| otry!(c.signer).force.clone(),
|
or |c: &Config| otry!(c.ui).force.clone(),
|
||||||
flag_no_signer: bool = false,
|
flag_no_ui: bool = false,
|
||||||
or |c: &Config| otry!(c.signer).disable.clone(),
|
or |c: &Config| otry!(c.ui).disable.clone(),
|
||||||
flag_signer_port: u16 = 8180u16,
|
flag_ui_port: u16 = 8180u16,
|
||||||
or |c: &Config| otry!(c.signer).port.clone(),
|
or |c: &Config| otry!(c.ui).port.clone(),
|
||||||
flag_signer_interface: String = "local",
|
flag_ui_interface: String = "local",
|
||||||
or |c: &Config| otry!(c.signer).interface.clone(),
|
or |c: &Config| otry!(c.ui).interface.clone(),
|
||||||
flag_signer_path: String = "$HOME/.parity/signer",
|
flag_ui_path: String = "$HOME/.parity/signer",
|
||||||
or |c: &Config| otry!(c.signer).path.clone(),
|
or |c: &Config| otry!(c.ui).path.clone(),
|
||||||
// NOTE [todr] For security reasons don't put this to config files
|
// NOTE [todr] For security reasons don't put this to config files
|
||||||
flag_signer_no_validation: bool = false, or |_| None,
|
flag_ui_no_validation: bool = false, or |_| None,
|
||||||
|
|
||||||
// -- Networking Options
|
// -- Networking Options
|
||||||
flag_warp: bool = false,
|
flag_warp: bool = false,
|
||||||
@ -271,7 +271,7 @@ usage! {
|
|||||||
struct Config {
|
struct Config {
|
||||||
parity: Option<Operating>,
|
parity: Option<Operating>,
|
||||||
account: Option<Account>,
|
account: Option<Account>,
|
||||||
signer: Option<Signer>,
|
ui: Option<Ui>,
|
||||||
network: Option<Network>,
|
network: Option<Network>,
|
||||||
rpc: Option<Rpc>,
|
rpc: Option<Rpc>,
|
||||||
ipc: Option<Ipc>,
|
ipc: Option<Ipc>,
|
||||||
@ -302,7 +302,7 @@ struct Account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
#[derive(Default, Debug, PartialEq, RustcDecodable)]
|
||||||
struct Signer {
|
struct Ui {
|
||||||
force: Option<bool>,
|
force: Option<bool>,
|
||||||
disable: Option<bool>,
|
disable: Option<bool>,
|
||||||
port: Option<u16>,
|
port: Option<u16>,
|
||||||
@ -418,7 +418,7 @@ struct Misc {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::{
|
use super::{
|
||||||
Args, ArgsError,
|
Args, ArgsError,
|
||||||
Config, Operating, Account, Signer, Network, Rpc, Ipc, Dapps, Mining, Footprint, Snapshots, VM, Misc
|
Config, Operating, Account, Ui, Network, Rpc, Ipc, Dapps, Mining, Footprint, Snapshots, VM, Misc
|
||||||
};
|
};
|
||||||
use toml;
|
use toml;
|
||||||
|
|
||||||
@ -511,12 +511,12 @@ mod tests {
|
|||||||
flag_password: vec!["~/.safe/password.file".into()],
|
flag_password: vec!["~/.safe/password.file".into()],
|
||||||
flag_keys_iterations: 10240u32,
|
flag_keys_iterations: 10240u32,
|
||||||
|
|
||||||
flag_force_signer: false,
|
flag_force_ui: false,
|
||||||
flag_no_signer: false,
|
flag_no_ui: false,
|
||||||
flag_signer_port: 8180u16,
|
flag_ui_port: 8180u16,
|
||||||
flag_signer_interface: "127.0.0.1".into(),
|
flag_ui_interface: "127.0.0.1".into(),
|
||||||
flag_signer_path: "$HOME/.parity/signer".into(),
|
flag_ui_path: "$HOME/.parity/signer".into(),
|
||||||
flag_signer_no_validation: false,
|
flag_ui_no_validation: false,
|
||||||
|
|
||||||
// -- Networking Options
|
// -- Networking Options
|
||||||
flag_warp: true,
|
flag_warp: true,
|
||||||
@ -675,7 +675,7 @@ mod tests {
|
|||||||
password: Some(vec!["passwdfile path".into()]),
|
password: Some(vec!["passwdfile path".into()]),
|
||||||
keys_iterations: None,
|
keys_iterations: None,
|
||||||
}),
|
}),
|
||||||
signer: Some(Signer {
|
ui: Some(Ui {
|
||||||
force: None,
|
force: None,
|
||||||
disable: Some(true),
|
disable: Some(true),
|
||||||
port: None,
|
port: None,
|
||||||
|
@ -43,28 +43,29 @@ Operating Options:
|
|||||||
Account Options:
|
Account Options:
|
||||||
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
|
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
|
||||||
ACCOUNTS is a comma-delimited list of addresses.
|
ACCOUNTS is a comma-delimited list of addresses.
|
||||||
Implies --no-signer. (default: {flag_unlock:?})
|
Implies --no-ui. (default: {flag_unlock:?})
|
||||||
--password FILE Provide a file containing a password for unlocking
|
--password FILE Provide a file containing a password for unlocking
|
||||||
an account. Leading and trailing whitespace is trimmed.
|
an account. Leading and trailing whitespace is trimmed.
|
||||||
(default: {flag_password:?})
|
(default: {flag_password:?})
|
||||||
--keys-iterations NUM Specify the number of iterations to use when
|
--keys-iterations NUM Specify the number of iterations to use when
|
||||||
deriving key from the password (bigger is more
|
deriving key from the password (bigger is more
|
||||||
secure) (default: {flag_keys_iterations}).
|
secure) (default: {flag_keys_iterations}).
|
||||||
--force-signer Enable Trusted Signer WebSocket endpoint used by
|
|
||||||
Signer UIs, even when --unlock is in use.
|
UI Options:
|
||||||
(default: ${flag_force_signer})
|
--force-ui Enable Trusted UI WebSocket endpoint,
|
||||||
--no-signer Disable Trusted Signer WebSocket endpoint used by
|
even when --unlock is in use. (default: ${flag_force_ui})
|
||||||
Signer UIs. (default: ${flag_no_signer})
|
--no-ui Disable Trusted UI WebSocket endpoint.
|
||||||
--signer-port PORT Specify the port of Trusted Signer server
|
(default: ${flag_no_ui})
|
||||||
(default: {flag_signer_port}).
|
--ui-port PORT Specify the port of Trusted UI server
|
||||||
--signer-interface IP Specify the hostname portion of the Trusted Signer
|
(default: {flag_ui_port}).
|
||||||
|
--ui-interface IP Specify the hostname portion of the Trusted UI
|
||||||
server, IP should be an interface's IP address,
|
server, IP should be an interface's IP address,
|
||||||
or local (default: {flag_signer_interface}).
|
or local (default: {flag_ui_interface}).
|
||||||
--signer-path PATH Specify directory where Signer UIs tokens should
|
--ui-path PATH Specify directory where Trusted UIs tokens should
|
||||||
be stored. (default: {flag_signer_path})
|
be stored. (default: {flag_ui_path})
|
||||||
--signer-no-validation Disable Origin and Host headers validation for
|
--ui-no-validation Disable Origin and Host headers validation for
|
||||||
Trusted Signer. WARNING: INSECURE. Used only for
|
Trusted UI. WARNING: INSECURE. Used only for
|
||||||
development. (default: {flag_signer_no_validation})
|
development. (default: {flag_ui_no_validation})
|
||||||
|
|
||||||
Networking Options:
|
Networking Options:
|
||||||
--warp Enable syncing from the snapshot over the network. (default: {flag_warp})
|
--warp Enable syncing from the snapshot over the network. (default: {flag_warp})
|
||||||
|
@ -95,7 +95,7 @@ impl Configuration {
|
|||||||
let wal = !self.args.flag_fast_and_loose;
|
let wal = !self.args.flag_fast_and_loose;
|
||||||
let warp_sync = self.args.flag_warp;
|
let warp_sync = self.args.flag_warp;
|
||||||
let geth_compatibility = self.args.flag_geth;
|
let geth_compatibility = self.args.flag_geth;
|
||||||
let signer_port = self.signer_port();
|
let ui_port = self.ui_port();
|
||||||
let dapps_conf = self.dapps_config();
|
let dapps_conf = self.dapps_config();
|
||||||
let signer_conf = self.signer_config();
|
let signer_conf = self.signer_config();
|
||||||
let format = try!(self.format());
|
let format = try!(self.format());
|
||||||
@ -243,7 +243,7 @@ impl Configuration {
|
|||||||
vm_type: vm_type,
|
vm_type: vm_type,
|
||||||
warp_sync: warp_sync,
|
warp_sync: warp_sync,
|
||||||
geth_compatibility: geth_compatibility,
|
geth_compatibility: geth_compatibility,
|
||||||
signer_port: signer_port,
|
ui_port: ui_port,
|
||||||
net_settings: self.network_settings(),
|
net_settings: self.network_settings(),
|
||||||
dapps_conf: dapps_conf,
|
dapps_conf: dapps_conf,
|
||||||
signer_conf: signer_conf,
|
signer_conf: signer_conf,
|
||||||
@ -396,11 +396,11 @@ impl Configuration {
|
|||||||
|
|
||||||
fn signer_config(&self) -> SignerConfiguration {
|
fn signer_config(&self) -> SignerConfiguration {
|
||||||
SignerConfiguration {
|
SignerConfiguration {
|
||||||
enabled: self.signer_enabled(),
|
enabled: self.ui_enabled(),
|
||||||
port: self.args.flag_signer_port,
|
port: self.args.flag_ui_port,
|
||||||
interface: self.signer_interface(),
|
interface: self.ui_interface(),
|
||||||
signer_path: self.directories().signer,
|
signer_path: self.directories().signer,
|
||||||
skip_origin_validation: self.args.flag_signer_no_validation,
|
skip_origin_validation: self.args.flag_ui_no_validation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +595,7 @@ impl Configuration {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let dapps_path = replace_home(&self.args.flag_dapps_path);
|
let dapps_path = replace_home(&self.args.flag_dapps_path);
|
||||||
let signer_path = replace_home(&self.args.flag_signer_path);
|
let ui_path = replace_home(&self.args.flag_ui_path);
|
||||||
|
|
||||||
if self.args.flag_geth && !cfg!(windows) {
|
if self.args.flag_geth && !cfg!(windows) {
|
||||||
let geth_root = if self.args.flag_testnet { path::ethereum::test() } else { path::ethereum::default() };
|
let geth_root = if self.args.flag_testnet { path::ethereum::test() } else { path::ethereum::default() };
|
||||||
@ -616,7 +616,7 @@ impl Configuration {
|
|||||||
keys: keys_path,
|
keys: keys_path,
|
||||||
db: db_path,
|
db: db_path,
|
||||||
dapps: dapps_path,
|
dapps: dapps_path,
|
||||||
signer: signer_path,
|
signer: ui_path,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,16 +628,16 @@ impl Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signer_port(&self) -> Option<u16> {
|
fn ui_port(&self) -> Option<u16> {
|
||||||
if !self.signer_enabled() {
|
if !self.ui_enabled() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(self.args.flag_signer_port)
|
Some(self.args.flag_ui_port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signer_interface(&self) -> String {
|
fn ui_interface(&self) -> String {
|
||||||
match self.args.flag_signer_interface.as_str() {
|
match self.args.flag_ui_interface.as_str() {
|
||||||
"local" => "127.0.0.1",
|
"local" => "127.0.0.1",
|
||||||
x => x,
|
x => x,
|
||||||
}.into()
|
}.into()
|
||||||
@ -662,16 +662,16 @@ impl Configuration {
|
|||||||
!self.args.flag_dapps_off && !self.args.flag_no_dapps && cfg!(feature = "dapps")
|
!self.args.flag_dapps_off && !self.args.flag_no_dapps && cfg!(feature = "dapps")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signer_enabled(&self) -> bool {
|
fn ui_enabled(&self) -> bool {
|
||||||
if self.args.flag_force_signer {
|
if self.args.flag_force_ui {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let signer_disabled = self.args.flag_unlock.is_some() ||
|
let ui_disabled = self.args.flag_unlock.is_some() ||
|
||||||
self.args.flag_geth ||
|
self.args.flag_geth ||
|
||||||
self.args.flag_no_signer;
|
self.args.flag_no_ui;
|
||||||
|
|
||||||
!signer_disabled
|
!ui_disabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ mod tests {
|
|||||||
wal: true,
|
wal: true,
|
||||||
vm_type: Default::default(),
|
vm_type: Default::default(),
|
||||||
geth_compatibility: false,
|
geth_compatibility: false,
|
||||||
signer_port: Some(8180),
|
ui_port: Some(8180),
|
||||||
net_settings: Default::default(),
|
net_settings: Default::default(),
|
||||||
dapps_conf: Default::default(),
|
dapps_conf: Default::default(),
|
||||||
signer_conf: Default::default(),
|
signer_conf: Default::default(),
|
||||||
@ -976,11 +976,11 @@ mod tests {
|
|||||||
|
|
||||||
// when
|
// when
|
||||||
let conf0 = parse(&["parity", "--geth"]);
|
let conf0 = parse(&["parity", "--geth"]);
|
||||||
let conf1 = parse(&["parity", "--geth", "--force-signer"]);
|
let conf1 = parse(&["parity", "--geth", "--force-ui"]);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assert_eq!(conf0.signer_enabled(), false);
|
assert_eq!(conf0.ui_enabled(), false);
|
||||||
assert_eq!(conf1.signer_enabled(), true);
|
assert_eq!(conf1.ui_enabled(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -991,7 +991,7 @@ mod tests {
|
|||||||
let conf0 = parse(&["parity", "--unlock", "0x0"]);
|
let conf0 = parse(&["parity", "--unlock", "0x0"]);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assert_eq!(conf0.signer_enabled(), false);
|
assert_eq!(conf0.ui_enabled(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -999,10 +999,10 @@ mod tests {
|
|||||||
// given
|
// given
|
||||||
|
|
||||||
// when
|
// when
|
||||||
let conf0 = parse(&["parity", "--signer-path", "signer"]);
|
let conf0 = parse(&["parity", "--ui-path", "signer"]);
|
||||||
let conf1 = parse(&["parity", "--signer-path", "signer", "--signer-no-validation"]);
|
let conf1 = parse(&["parity", "--ui-path", "signer", "--ui-no-validation"]);
|
||||||
let conf2 = parse(&["parity", "--signer-path", "signer", "--signer-port", "3123"]);
|
let conf2 = parse(&["parity", "--ui-path", "signer", "--ui-port", "3123"]);
|
||||||
let conf3 = parse(&["parity", "--signer-path", "signer", "--signer-interface", "test"]);
|
let conf3 = parse(&["parity", "--ui-path", "signer", "--ui-interface", "test"]);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assert_eq!(conf0.signer_config(), SignerConfiguration {
|
assert_eq!(conf0.signer_config(), SignerConfiguration {
|
||||||
|
@ -82,7 +82,7 @@ pub struct RunCmd {
|
|||||||
pub wal: bool,
|
pub wal: bool,
|
||||||
pub vm_type: VMType,
|
pub vm_type: VMType,
|
||||||
pub geth_compatibility: bool,
|
pub geth_compatibility: bool,
|
||||||
pub signer_port: Option<u16>,
|
pub ui_port: Option<u16>,
|
||||||
pub net_settings: NetworkSettings,
|
pub net_settings: NetworkSettings,
|
||||||
pub dapps_conf: dapps::Configuration,
|
pub dapps_conf: dapps::Configuration,
|
||||||
pub signer_conf: signer::Configuration,
|
pub signer_conf: signer::Configuration,
|
||||||
@ -262,7 +262,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
|
|||||||
let deps_for_rpc_apis = Arc::new(rpc_apis::Dependencies {
|
let deps_for_rpc_apis = Arc::new(rpc_apis::Dependencies {
|
||||||
signer_service: Arc::new(rpc_apis::SignerService::new(move || {
|
signer_service: Arc::new(rpc_apis::SignerService::new(move || {
|
||||||
signer::generate_new_token(signer_path.clone()).map_err(|e| format!("{:?}", e))
|
signer::generate_new_token(signer_path.clone()).map_err(|e| format!("{:?}", e))
|
||||||
}, cmd.signer_port)),
|
}, cmd.ui_port)),
|
||||||
snapshot: snapshot_service.clone(),
|
snapshot: snapshot_service.clone(),
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
sync: sync_provider.clone(),
|
sync: sync_provider.clone(),
|
||||||
|
@ -109,7 +109,7 @@ fn do_start(conf: Configuration, deps: Dependencies) -> Result<SignerServer, Str
|
|||||||
|
|
||||||
match start_result {
|
match start_result {
|
||||||
Err(signer::ServerError::IoError(err)) => match err.kind() {
|
Err(signer::ServerError::IoError(err)) => match err.kind() {
|
||||||
io::ErrorKind::AddrInUse => Err(format!("Trusted Signer address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --signer-port and --signer-interface options.", addr)),
|
io::ErrorKind::AddrInUse => Err(format!("Trusted UI address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --ui-port and --ui-interface options.", addr)),
|
||||||
_ => Err(format!("Trusted Signer io error: {}", err)),
|
_ => Err(format!("Trusted Signer io error: {}", err)),
|
||||||
},
|
},
|
||||||
Err(e) => Err(format!("Trusted Signer Error: {:?}", e)),
|
Err(e) => Err(format!("Trusted Signer Error: {:?}", e)),
|
||||||
|
Loading…
Reference in New Issue
Block a user