Adding CLI flags for IPFS

This commit is contained in:
maciejhirsz 2017-02-15 20:29:29 +01:00
parent 9cfa27830c
commit 451cf42452
4 changed files with 33 additions and 1 deletions

View File

@ -67,6 +67,10 @@ path = "$HOME/.parity/dapps"
user = "test_user" user = "test_user"
pass = "test_pass" pass = "test_pass"
[ipfs]
disable = true
port = 5001
[mining] [mining]
author = "0xdeadbeefcafe0000000000000000000000000001" author = "0xdeadbeefcafe0000000000000000000000000001"
engine_signer = "0xdeadbeefcafe0000000000000000000000000001" engine_signer = "0xdeadbeefcafe0000000000000000000000000001"

View File

@ -38,6 +38,10 @@ port = 8080
user = "username" user = "username"
pass = "password" pass = "password"
[ipfs]
disable = true
port = 5001
[mining] [mining]
author = "0xdeadbeefcafe0000000000000000000000000001" author = "0xdeadbeefcafe0000000000000000000000000001"
engine_signer = "0xdeadbeefcafe0000000000000000000000000001" engine_signer = "0xdeadbeefcafe0000000000000000000000000001"

View File

@ -189,6 +189,12 @@ usage! {
or |c: &Config| otry!(c.dapps).pass.clone().map(Some), or |c: &Config| otry!(c.dapps).pass.clone().map(Some),
flag_dapps_apis_all: bool = false, or |_| None, flag_dapps_apis_all: bool = false, or |_| None,
// IPFS
flag_ipfs_off: bool = true,
or |c: &Config| otry!(c.ipfs).disable.clone(),
flag_ipfs_port: u16 = 5001u16,
or |c: &Config| otry!(c.ipfs).port.clone(),
// -- Sealing/Mining Options // -- Sealing/Mining Options
flag_author: Option<String> = None, flag_author: Option<String> = None,
or |c: &Config| otry!(c.mining).author.clone().map(Some), or |c: &Config| otry!(c.mining).author.clone().map(Some),
@ -321,6 +327,7 @@ struct Config {
rpc: Option<Rpc>, rpc: Option<Rpc>,
ipc: Option<Ipc>, ipc: Option<Ipc>,
dapps: Option<Dapps>, dapps: Option<Dapps>,
ipfs: Option<Ipfs>,
mining: Option<Mining>, mining: Option<Mining>,
footprint: Option<Footprint>, footprint: Option<Footprint>,
snapshots: Option<Snapshots>, snapshots: Option<Snapshots>,
@ -409,6 +416,12 @@ struct Dapps {
pass: Option<String>, pass: Option<String>,
} }
#[derive(Default, Debug, PartialEq, RustcDecodable)]
struct Ipfs {
disable: Option<bool>,
port: Option<u16>,
}
#[derive(Default, Debug, PartialEq, RustcDecodable)] #[derive(Default, Debug, PartialEq, RustcDecodable)]
struct Mining { struct Mining {
author: Option<String>, author: Option<String>,
@ -482,7 +495,7 @@ struct Misc {
mod tests { mod tests {
use super::{ use super::{
Args, ArgsError, Args, ArgsError,
Config, Operating, Account, Ui, Network, Rpc, Ipc, Dapps, Mining, Footprint, Snapshots, VM, Misc Config, Operating, Account, Ui, Network, Rpc, Ipc, Dapps, Ipfs, Mining, Footprint, Snapshots, VM, Misc
}; };
use toml; use toml;
@ -637,6 +650,10 @@ mod tests {
flag_dapps_pass: Some("test_pass".into()), flag_dapps_pass: Some("test_pass".into()),
flag_dapps_apis_all: false, flag_dapps_apis_all: false,
// IPFS
flag_ipfs_off: true,
flag_ipfs_port: 5001u16,
// -- Sealing/Mining Options // -- Sealing/Mining Options
flag_author: Some("0xdeadbeefcafe0000000000000000000000000001".into()), flag_author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
flag_engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()), flag_engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
@ -822,6 +839,10 @@ mod tests {
user: Some("username".into()), user: Some("username".into()),
pass: Some("password".into()) pass: Some("password".into())
}), }),
ipfs: Some(Ipfs {
disable: Some(true),
port: Some(5001)
}),
mining: Some(Mining { mining: Some(Mining {
author: Some("0xdeadbeefcafe0000000000000000000000000001".into()), author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()), engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),

View File

@ -175,6 +175,9 @@ API and Console Options:
--dapps-apis-all Expose all possible RPC APIs on Dapps port. --dapps-apis-all Expose all possible RPC APIs on Dapps port.
WARNING: INSECURE. Used only for development. WARNING: INSECURE. Used only for development.
(default: {flag_dapps_apis_all}) (default: {flag_dapps_apis_all})
--no-ipfs Disable IPFS-compatible HTTP API. (default: {flag_ipfs_off})
--ipfs-port PORT Configure on which port the IPFS HTTP API should listen.
(default: {flag_ipfs_port})
Sealing/Mining Options: Sealing/Mining Options:
--author ADDRESS Specify the block author (aka "coinbase") address --author ADDRESS Specify the block author (aka "coinbase") address