mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 04:28:01 +00:00
Add --chain option. (#122)
* Add --chain option. * Reinstate bail on unknown runtime.
This commit is contained in:
@@ -48,4 +48,9 @@ args:
|
||||
help: Specify a list of bootnodes
|
||||
takes_value: true
|
||||
multiple: true
|
||||
- chain:
|
||||
long: chain
|
||||
value_name: CHAIN_SPEC
|
||||
help: Specify the chain specification (one of dev or poc-1)
|
||||
takes_value: true
|
||||
subcommands:
|
||||
|
||||
@@ -52,6 +52,7 @@ use std::net::SocketAddr;
|
||||
use futures::sync::mpsc;
|
||||
use futures::{Sink, Future, Stream};
|
||||
use tokio_core::reactor;
|
||||
use service::ChainSpec;
|
||||
|
||||
/// Parse command line arguments and start the node.
|
||||
///
|
||||
@@ -104,6 +105,17 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
|
||||
role = service::Role::VALIDATOR;
|
||||
}
|
||||
|
||||
match matches.value_of("chain") {
|
||||
Some("poc-1") => config.chain_spec = ChainSpec::PoC1Testnet,
|
||||
Some("dev") => config.chain_spec = ChainSpec::Development,
|
||||
None => (),
|
||||
Some(unknown) => panic!("Invalid chain name: {}", unknown),
|
||||
}
|
||||
info!("Chain specification: {}", match config.chain_spec {
|
||||
ChainSpec::Development => "Local Development",
|
||||
ChainSpec::PoC1Testnet => "PoC-1 Testnet",
|
||||
});
|
||||
|
||||
config.roles = role;
|
||||
config.network.boot_nodes = matches
|
||||
.values_of("bootnodes")
|
||||
|
||||
Reference in New Issue
Block a user