mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
CLI API refactoring and improvement (#4692)
It changes the way we extended the CLI functionalities of substrate to allow more flexibility. (If this was not clear, here is another version: it changes the `sc_cli` API to allow more flexibility).
This touches a few important things:
- the startup of the async task with tokei:
This was in node and node-template and I moved it to substrate. The idea is to have 1 time the code that handles unix signals (SIGTERM and SIGINT) properly. It is however possible to make this more generic to wait for a future instead and provide only a helper for the basic handling of SIGTERM and SIGINT.
- increased the version of structopt and tokei
- no more use of structopt internal's API
- less use of generics
Related to #4643 and https://github.com/paritytech/cumulus/pull/42: the implementation of "into_configuration" and "get_config" are similar but with better flexibility so it is now possible in cumulus to have the command-line arguments only of the run command for polkadot if we want
Related to https://github.com/paritytech/cumulus/issues/24 and https://github.com/paritytech/cumulus/issues/34 : it will now be possible to make a configuration struct for polkadot with some overrides of the default parameters much more easily.
This commit is contained in:
@@ -34,25 +34,24 @@ pub use console_log::init_with_level as init_console_log;
|
||||
/// Create a service configuration from a chain spec and the websocket transport.
|
||||
///
|
||||
/// This configuration contains good defaults for a browser light client.
|
||||
pub async fn browser_configuration<C, G, E>(
|
||||
pub async fn browser_configuration<G, E>(
|
||||
transport: Transport,
|
||||
chain_spec: ChainSpec<G, E>,
|
||||
) -> Result<Configuration<C, G, E>, Box<dyn std::error::Error>>
|
||||
) -> Result<Configuration<G, E>, Box<dyn std::error::Error>>
|
||||
where
|
||||
C: Default,
|
||||
G: RuntimeGenesis,
|
||||
E: Extension,
|
||||
{
|
||||
let name = chain_spec.name().to_string();
|
||||
|
||||
let transport = ExtTransport::new(transport);
|
||||
let mut config = Configuration::default_with_spec_and_base_path(chain_spec, None);
|
||||
let mut config = Configuration::default();
|
||||
config.network.transport = network::config::TransportConfig::Normal {
|
||||
wasm_external_transport: Some(transport.clone()),
|
||||
allow_private_ipv4: true,
|
||||
enable_mdns: false,
|
||||
};
|
||||
config.tasks_executor = Some(Box::new(move |fut| {
|
||||
config.task_executor = Some(Box::new(move |fut| {
|
||||
wasm_bindgen_futures::spawn_local(fut)
|
||||
}));
|
||||
config.telemetry_external_transport = Some(transport);
|
||||
|
||||
Reference in New Issue
Block a user