From 451cf42452e28b25bc8f5535ad38b8cb2d36267c Mon Sep 17 00:00:00 2001 From: maciejhirsz Date: Wed, 15 Feb 2017 20:29:29 +0100 Subject: [PATCH] Adding CLI flags for IPFS --- parity/cli/config.full.toml | 4 ++++ parity/cli/config.toml | 4 ++++ parity/cli/mod.rs | 23 ++++++++++++++++++++++- parity/cli/usage.txt | 3 +++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/parity/cli/config.full.toml b/parity/cli/config.full.toml index 5e6bc367a..b527a9b65 100644 --- a/parity/cli/config.full.toml +++ b/parity/cli/config.full.toml @@ -67,6 +67,10 @@ path = "$HOME/.parity/dapps" user = "test_user" pass = "test_pass" +[ipfs] +disable = true +port = 5001 + [mining] author = "0xdeadbeefcafe0000000000000000000000000001" engine_signer = "0xdeadbeefcafe0000000000000000000000000001" diff --git a/parity/cli/config.toml b/parity/cli/config.toml index 608999799..66886e71e 100644 --- a/parity/cli/config.toml +++ b/parity/cli/config.toml @@ -38,6 +38,10 @@ port = 8080 user = "username" pass = "password" +[ipfs] +disable = true +port = 5001 + [mining] author = "0xdeadbeefcafe0000000000000000000000000001" engine_signer = "0xdeadbeefcafe0000000000000000000000000001" diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 7ac7f8c8d..4cb7ff4e5 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -189,6 +189,12 @@ usage! { or |c: &Config| otry!(c.dapps).pass.clone().map(Some), 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 flag_author: Option = None, or |c: &Config| otry!(c.mining).author.clone().map(Some), @@ -321,6 +327,7 @@ struct Config { rpc: Option, ipc: Option, dapps: Option, + ipfs: Option, mining: Option, footprint: Option, snapshots: Option, @@ -409,6 +416,12 @@ struct Dapps { pass: Option, } +#[derive(Default, Debug, PartialEq, RustcDecodable)] +struct Ipfs { + disable: Option, + port: Option, +} + #[derive(Default, Debug, PartialEq, RustcDecodable)] struct Mining { author: Option, @@ -482,7 +495,7 @@ struct Misc { mod tests { use super::{ 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; @@ -637,6 +650,10 @@ mod tests { flag_dapps_pass: Some("test_pass".into()), flag_dapps_apis_all: false, + // IPFS + flag_ipfs_off: true, + flag_ipfs_port: 5001u16, + // -- Sealing/Mining Options flag_author: Some("0xdeadbeefcafe0000000000000000000000000001".into()), flag_engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()), @@ -822,6 +839,10 @@ mod tests { user: Some("username".into()), pass: Some("password".into()) }), + ipfs: Some(Ipfs { + disable: Some(true), + port: Some(5001) + }), mining: Some(Mining { author: Some("0xdeadbeefcafe0000000000000000000000000001".into()), engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()), diff --git a/parity/cli/usage.txt b/parity/cli/usage.txt index 90c207378..c13e0dee7 100644 --- a/parity/cli/usage.txt +++ b/parity/cli/usage.txt @@ -175,6 +175,9 @@ API and Console Options: --dapps-apis-all Expose all possible RPC APIs on Dapps port. WARNING: INSECURE. Used only for development. (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: --author ADDRESS Specify the block author (aka "coinbase") address