Merge branch 'master' into unlock
This commit is contained in:
@@ -841,6 +841,7 @@ impl Configuration {
|
||||
hosts: self.ws_hosts(),
|
||||
origins: self.ws_origins(),
|
||||
signer_path: self.directories().signer.into(),
|
||||
support_token_api: !self.args.flag_public_node,
|
||||
ui_address: ui.address(),
|
||||
};
|
||||
|
||||
@@ -1037,7 +1038,7 @@ impl Configuration {
|
||||
self.args.flag_geth ||
|
||||
self.args.flag_no_ui;
|
||||
|
||||
!ui_disabled
|
||||
!ui_disabled && cfg!(feature = "ui-enabled")
|
||||
}
|
||||
|
||||
fn verifier_settings(&self) -> VerifierSettings {
|
||||
@@ -1248,6 +1249,7 @@ mod tests {
|
||||
hosts: Some(vec![]),
|
||||
signer_path: expected.into(),
|
||||
ui_address: Some(("127.0.0.1".to_owned(), 8180)),
|
||||
support_token_api: true
|
||||
}, UiConfiguration {
|
||||
enabled: true,
|
||||
interface: "127.0.0.1".into(),
|
||||
|
||||
@@ -102,7 +102,7 @@ impl From<UiConfiguration> for HttpConfiguration {
|
||||
impl Default for UiConfiguration {
|
||||
fn default() -> Self {
|
||||
UiConfiguration {
|
||||
enabled: true,
|
||||
enabled: true && cfg!(feature = "ui-enabled"),
|
||||
port: 8180,
|
||||
interface: "127.0.0.1".into(),
|
||||
hosts: Some(vec![]),
|
||||
@@ -141,6 +141,7 @@ pub struct WsConfiguration {
|
||||
pub origins: Option<Vec<String>>,
|
||||
pub hosts: Option<Vec<String>>,
|
||||
pub signer_path: PathBuf,
|
||||
pub support_token_api: bool,
|
||||
pub ui_address: Option<(String, u16)>,
|
||||
}
|
||||
|
||||
@@ -155,6 +156,7 @@ impl Default for WsConfiguration {
|
||||
origins: Some(vec!["chrome-extension://*".into()]),
|
||||
hosts: Some(Vec::new()),
|
||||
signer_path: replace_home(&data_dir, "$BASE/signer").into(),
|
||||
support_token_api: true,
|
||||
ui_address: Some(("127.0.0.1".to_owned(), 8180)),
|
||||
}
|
||||
}
|
||||
@@ -207,9 +209,14 @@ pub fn new_ws<D: rpc_apis::Dependencies>(
|
||||
let allowed_origins = into_domains(with_domain(conf.origins, domain, &[ui_address]));
|
||||
let allowed_hosts = into_domains(with_domain(conf.hosts, domain, &[Some(ws_address)]));
|
||||
|
||||
let signer_path = conf.signer_path;
|
||||
let signer_path = conf.ui_address.map(move |_| ::signer::codes_path(&signer_path));
|
||||
let path = signer_path.as_ref().map(|p| p.as_path());
|
||||
let signer_path;
|
||||
let path = match conf.support_token_api && conf.ui_address.is_some() {
|
||||
true => {
|
||||
signer_path = ::signer::codes_path(&conf.signer_path);
|
||||
Some(signer_path.as_path())
|
||||
},
|
||||
false => None
|
||||
};
|
||||
let start_result = rpc::start_ws(
|
||||
&addr,
|
||||
handler,
|
||||
|
||||
Reference in New Issue
Block a user