Allow specifying extra cors headers for dapps (#4710)

This commit is contained in:
Tomasz Drwięga
2017-03-07 17:33:28 +01:00
committed by Arkadiy Paronyan
parent ae3f85bd5b
commit 4868f758bf
8 changed files with 76 additions and 10 deletions

View File

@@ -181,6 +181,8 @@ usage! {
or |c: &Config| otry!(c.dapps).interface.clone(),
flag_dapps_hosts: String = "none",
or |c: &Config| otry!(c.dapps).hosts.as_ref().map(|vec| vec.join(",")),
flag_dapps_cors: Option<String> = None,
or |c: &Config| otry!(c.dapps).cors.clone().map(Some),
flag_dapps_path: String = "$BASE/dapps",
or |c: &Config| otry!(c.dapps).path.clone(),
flag_dapps_user: Option<String> = None,
@@ -428,6 +430,7 @@ struct Dapps {
port: Option<u16>,
interface: Option<String>,
hosts: Option<Vec<String>>,
cors: Option<String>,
path: Option<String>,
user: Option<String>,
pass: Option<String>,
@@ -674,6 +677,7 @@ mod tests {
flag_dapps_port: 8080u16,
flag_dapps_interface: "local".into(),
flag_dapps_hosts: "none".into(),
flag_dapps_cors: None,
flag_dapps_path: "$HOME/.parity/dapps".into(),
flag_dapps_user: Some("test_user".into()),
flag_dapps_pass: Some("test_pass".into()),
@@ -873,6 +877,7 @@ mod tests {
path: None,
interface: None,
hosts: None,
cors: None,
user: Some("username".into()),
pass: Some("password".into())
}),

View File

@@ -164,6 +164,8 @@ API and Console Options:
is additional security against some attack
vectors. Special options: "all", "none",
(default: {flag_dapps_hosts}).
--dapps-cors URL Specify CORS headers for Dapps server APIs.
(default: {flag_dapps_cors:?})
--dapps-user USERNAME Specify username for Dapps server. It will be
used in HTTP Basic Authentication Scheme.
If --dapps-pass is not specified you will be