Tidy up CLI options and make JSONRPC & webapps on by default. (#1045)
* Tidy up CLI options and make JSONRPC & webapps on by default. * Fix test.
This commit is contained in:
parent
ad00bd7bc8
commit
0d507922ce
@ -59,7 +59,7 @@ Networking Options:
|
|||||||
string or input to SHA3 operation.
|
string or input to SHA3 operation.
|
||||||
|
|
||||||
API and Console Options:
|
API and Console Options:
|
||||||
-j --jsonrpc Enable the JSON-RPC API server.
|
--jsonrpc-off Disable the JSON-RPC API server.
|
||||||
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server
|
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server
|
||||||
[default: 8545].
|
[default: 8545].
|
||||||
--jsonrpc-interface IP Specify the hostname portion of the JSONRPC API
|
--jsonrpc-interface IP Specify the hostname portion of the JSONRPC API
|
||||||
@ -68,10 +68,18 @@ API and Console Options:
|
|||||||
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses.
|
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses.
|
||||||
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC
|
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC
|
||||||
interface. APIS is a comma-delimited list of API
|
interface. APIS is a comma-delimited list of API
|
||||||
name. Possible name are web3, eth and net.
|
name. Possible name are web3, eth, net, personal,
|
||||||
|
ethcore, traces.
|
||||||
[default: web3,eth,net,personal,ethcore,traces].
|
[default: web3,eth,net,personal,ethcore,traces].
|
||||||
-w --webapp Enable the web applications server (e.g.
|
|
||||||
status page).
|
--ipc-off Disable JSON-RPC over IPC service.
|
||||||
|
--ipc-path PATH Specify custom path for JSON-RPC over IPC service
|
||||||
|
[default: $HOME/.parity/jsonrpc.ipc].
|
||||||
|
--ipc-apis APIS Specify custom API set available via JSON-RPC over
|
||||||
|
IPC [default: web3,eth,net,personal,ethcore].
|
||||||
|
|
||||||
|
--webapp-off Disable the web applications server (e.g. status
|
||||||
|
page).
|
||||||
--webapp-port PORT Specify the port portion of the WebApps server
|
--webapp-port PORT Specify the port portion of the WebApps server
|
||||||
[default: 8080].
|
[default: 8080].
|
||||||
--webapp-interface IP Specify the hostname portion of the WebApps
|
--webapp-interface IP Specify the hostname portion of the WebApps
|
||||||
@ -84,12 +92,6 @@ API and Console Options:
|
|||||||
--webapp-pass PASSWORD Specify password for WebApps server. Use only in
|
--webapp-pass PASSWORD Specify password for WebApps server. Use only in
|
||||||
conjunction with --webapp-user.
|
conjunction with --webapp-user.
|
||||||
|
|
||||||
--ipc-disable Disable JSON-RPC over IPC service
|
|
||||||
--ipc-path PATH Specify custom path for IPC service
|
|
||||||
[default: $HOME/.parity/jsonrpc.ipc]
|
|
||||||
--ipc-api APIS Specify custom API set available via IPC service
|
|
||||||
[default: web3,eth,net,personal,ethcore]
|
|
||||||
|
|
||||||
Sealing/Mining Options:
|
Sealing/Mining Options:
|
||||||
--force-sealing Force the node to author new blocks as if it were
|
--force-sealing Force the node to author new blocks as if it were
|
||||||
always sealing/mining.
|
always sealing/mining.
|
||||||
@ -133,18 +135,23 @@ Footprint Options:
|
|||||||
the entire system, overrides other cache and queue
|
the entire system, overrides other cache and queue
|
||||||
options.
|
options.
|
||||||
|
|
||||||
Geth-compatibility Options:
|
Legacy Options:
|
||||||
--datadir PATH Equivalent to --db-path PATH.
|
--datadir PATH Equivalent to --db-path PATH.
|
||||||
--testnet Equivalent to --chain testnet.
|
--testnet Equivalent to --chain testnet.
|
||||||
--networkid INDEX Equivalent to --network-id INDEX.
|
--networkid INDEX Equivalent to --network-id INDEX.
|
||||||
--maxpeers COUNT Equivalent to --peers COUNT.
|
--maxpeers COUNT Equivalent to --peers COUNT.
|
||||||
--nodekey KEY Equivalent to --node-key KEY.
|
--nodekey KEY Equivalent to --node-key KEY.
|
||||||
--nodiscover Equivalent to --no-discovery.
|
--nodiscover Equivalent to --no-discovery.
|
||||||
--rpc Equivalent to --jsonrpc.
|
-j --jsonrpc Does nothing; JSON-RPC is on by default now.
|
||||||
|
-w --webapp Does nothing; web app server is on by default now.
|
||||||
|
--rpc Does nothing; JSON-RPC is on by default now.
|
||||||
--rpcaddr IP Equivalent to --jsonrpc-interface IP.
|
--rpcaddr IP Equivalent to --jsonrpc-interface IP.
|
||||||
--rpcport PORT Equivalent to --jsonrpc-port PORT.
|
--rpcport PORT Equivalent to --jsonrpc-port PORT.
|
||||||
--rpcapi APIS Equivalent to --jsonrpc-apis APIS.
|
--rpcapi APIS Equivalent to --jsonrpc-apis APIS.
|
||||||
--rpccorsdomain URL Equivalent to --jsonrpc-cors URL.
|
--rpccorsdomain URL Equivalent to --jsonrpc-cors URL.
|
||||||
|
--ipcdisable Equivalent to --ipc-off.
|
||||||
|
--ipcapi APIS Equivalent to --ipc-apis APIS.
|
||||||
|
--ipcpath PATH Equivalent to --ipc-path PATH.
|
||||||
--gasprice WEI Minimum amount of Wei per GAS to be paid for a
|
--gasprice WEI Minimum amount of Wei per GAS to be paid for a
|
||||||
transaction to be accepted for mining. Overrides
|
transaction to be accepted for mining. Overrides
|
||||||
--basic-tx-usd.
|
--basic-tx-usd.
|
||||||
@ -184,12 +191,15 @@ pub struct Args {
|
|||||||
pub flag_cache_pref_size: usize,
|
pub flag_cache_pref_size: usize,
|
||||||
pub flag_cache_max_size: usize,
|
pub flag_cache_max_size: usize,
|
||||||
pub flag_queue_max_size: usize,
|
pub flag_queue_max_size: usize,
|
||||||
pub flag_jsonrpc: bool,
|
pub flag_jsonrpc_off: bool,
|
||||||
pub flag_jsonrpc_interface: String,
|
pub flag_jsonrpc_interface: String,
|
||||||
pub flag_jsonrpc_port: u16,
|
pub flag_jsonrpc_port: u16,
|
||||||
pub flag_jsonrpc_cors: Option<String>,
|
pub flag_jsonrpc_cors: Option<String>,
|
||||||
pub flag_jsonrpc_apis: String,
|
pub flag_jsonrpc_apis: String,
|
||||||
pub flag_webapp: bool,
|
pub flag_ipc_off: bool,
|
||||||
|
pub flag_ipc_path: String,
|
||||||
|
pub flag_ipc_apis: String,
|
||||||
|
pub flag_webapp_off: bool,
|
||||||
pub flag_webapp_port: u16,
|
pub flag_webapp_port: u16,
|
||||||
pub flag_webapp_interface: String,
|
pub flag_webapp_interface: String,
|
||||||
pub flag_webapp_user: Option<String>,
|
pub flag_webapp_user: Option<String>,
|
||||||
@ -203,10 +213,7 @@ pub struct Args {
|
|||||||
pub flag_tx_limit: usize,
|
pub flag_tx_limit: usize,
|
||||||
pub flag_logging: Option<String>,
|
pub flag_logging: Option<String>,
|
||||||
pub flag_version: bool,
|
pub flag_version: bool,
|
||||||
pub flag_ipc_disable: bool,
|
// legacy...
|
||||||
pub flag_ipc_path: String,
|
|
||||||
pub flag_ipc_api: String,
|
|
||||||
// geth-compatibility...
|
|
||||||
pub flag_nodekey: Option<String>,
|
pub flag_nodekey: Option<String>,
|
||||||
pub flag_nodiscover: bool,
|
pub flag_nodiscover: bool,
|
||||||
pub flag_maxpeers: Option<usize>,
|
pub flag_maxpeers: Option<usize>,
|
||||||
@ -214,6 +221,8 @@ pub struct Args {
|
|||||||
pub flag_extradata: Option<String>,
|
pub flag_extradata: Option<String>,
|
||||||
pub flag_etherbase: Option<String>,
|
pub flag_etherbase: Option<String>,
|
||||||
pub flag_gasprice: Option<String>,
|
pub flag_gasprice: Option<String>,
|
||||||
|
pub flag_jsonrpc: bool,
|
||||||
|
pub flag_webapp: bool,
|
||||||
pub flag_rpc: bool,
|
pub flag_rpc: bool,
|
||||||
pub flag_rpcaddr: Option<String>,
|
pub flag_rpcaddr: Option<String>,
|
||||||
pub flag_rpcport: Option<u16>,
|
pub flag_rpcport: Option<u16>,
|
||||||
@ -221,6 +230,9 @@ pub struct Args {
|
|||||||
pub flag_rpcapi: Option<String>,
|
pub flag_rpcapi: Option<String>,
|
||||||
pub flag_testnet: bool,
|
pub flag_testnet: bool,
|
||||||
pub flag_networkid: Option<String>,
|
pub flag_networkid: Option<String>,
|
||||||
|
pub flag_ipcdisable: bool,
|
||||||
|
pub flag_ipcpath: Option<String>,
|
||||||
|
pub flag_ipcapi: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_version() {
|
pub fn print_version() {
|
||||||
|
@ -269,20 +269,21 @@ impl Configuration {
|
|||||||
|
|
||||||
pub fn ipc_settings(&self) -> IpcConfiguration {
|
pub fn ipc_settings(&self) -> IpcConfiguration {
|
||||||
IpcConfiguration {
|
IpcConfiguration {
|
||||||
enabled: !self.args.flag_ipc_disable,
|
enabled: !(self.args.flag_ipcdisable || self.args.flag_ipc_off),
|
||||||
socket_addr: self.args.flag_ipc_path.clone()
|
socket_addr: self.args.flag_ipcpath.clone().unwrap_or(self.args.flag_ipc_path.clone())
|
||||||
.replace("$HOME", env::home_dir().unwrap().to_str().unwrap()),
|
.replace("$HOME", env::home_dir().unwrap().to_str().unwrap()),
|
||||||
apis: self.args.flag_ipc_api.clone(),
|
apis: self.args.flag_ipcapi.clone().unwrap_or(self.args.flag_ipc_apis.clone()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn network_settings(&self) -> NetworkSettings {
|
pub fn network_settings(&self) -> NetworkSettings {
|
||||||
|
if self.args.flag_jsonrpc { println!("WARNING: Flag -j/--json-rpc is deprecated. JSON-RPC is now on by default. Ignoring."); }
|
||||||
NetworkSettings {
|
NetworkSettings {
|
||||||
name: self.args.flag_identity.clone(),
|
name: self.args.flag_identity.clone(),
|
||||||
chain: self.chain(),
|
chain: self.chain(),
|
||||||
max_peers: self.max_peers(),
|
max_peers: self.max_peers(),
|
||||||
network_port: self.net_port(),
|
network_port: self.net_port(),
|
||||||
rpc_enabled: self.args.flag_rpc || self.args.flag_jsonrpc,
|
rpc_enabled: !self.args.flag_jsonrpc_off,
|
||||||
rpc_interface: self.args.flag_rpcaddr.clone().unwrap_or(self.args.flag_jsonrpc_interface.clone()),
|
rpc_interface: self.args.flag_rpcaddr.clone().unwrap_or(self.args.flag_jsonrpc_interface.clone()),
|
||||||
rpc_port: self.args.flag_rpcport.unwrap_or(self.args.flag_jsonrpc_port),
|
rpc_port: self.args.flag_rpcport.unwrap_or(self.args.flag_jsonrpc_port),
|
||||||
}
|
}
|
||||||
@ -315,7 +316,7 @@ mod tests {
|
|||||||
chain: "morden".to_owned(),
|
chain: "morden".to_owned(),
|
||||||
max_peers: 25,
|
max_peers: 25,
|
||||||
network_port: 30303,
|
network_port: 30303,
|
||||||
rpc_enabled: false,
|
rpc_enabled: true,
|
||||||
rpc_interface: "local".to_owned(),
|
rpc_interface: "local".to_owned(),
|
||||||
rpc_port: 8545,
|
rpc_port: 8545,
|
||||||
});
|
});
|
||||||
|
@ -181,10 +181,11 @@ fn execute_client(conf: Configuration) {
|
|||||||
}, &dependencies);
|
}, &dependencies);
|
||||||
|
|
||||||
// setup ipc rpc
|
// setup ipc rpc
|
||||||
let ipc_server = rpc::new_ipc(conf.ipc_settings(), &dependencies);
|
let _ipc_server = rpc::new_ipc(conf.ipc_settings(), &dependencies);
|
||||||
|
|
||||||
|
if conf.args.flag_webapp { println!("WARNING: Flag -w/--webapp is deprecated. Web app server is now on by default. Ignoring."); }
|
||||||
let webapp_server = webapp::new(webapp::Configuration {
|
let webapp_server = webapp::new(webapp::Configuration {
|
||||||
enabled: conf.args.flag_webapp,
|
enabled: !conf.args.flag_webapp_off,
|
||||||
interface: conf.args.flag_webapp_interface.clone(),
|
interface: conf.args.flag_webapp_interface.clone(),
|
||||||
port: conf.args.flag_webapp_port,
|
port: conf.args.flag_webapp_port,
|
||||||
user: conf.args.flag_webapp_user.clone(),
|
user: conf.args.flag_webapp_user.clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user