Struct sc_cli::SharedParams
source · pub struct SharedParams {
pub chain: Option<String>,
pub dev: bool,
pub base_path: Option<PathBuf>,
pub log: Vec<String>,
pub detailed_log_output: bool,
pub disable_log_color: bool,
pub enable_log_reloading: bool,
pub tracing_targets: Option<String>,
pub tracing_receiver: TracingReceiver,
}Expand description
Shared parameters used by all CoreParams.
Fields§
§chain: Option<String>Specify the chain specification.
It can be one of the predefined ones (dev, local, or staging) or it can be a path to a file
with the chainspec (such as one exported by the build-spec subcommand).
dev: boolSpecify the development chain.
This flag sets --chain=dev, --force-authoring, --rpc-cors=all,
--alice, and --tmp flags, unless explicitly overridden.
base_path: Option<PathBuf>Specify custom base path.
log: Vec<String>Sets a custom logging filter. Syntax is <target>=<level>, e.g. -lsync=debug.
Log levels (least to most verbose) are error, warn, info, debug, and trace.
By default, all targets log info. The global log level can be set with -l<level>.
detailed_log_output: boolEnable detailed log output.
This includes displaying the log target, log level and thread name.
This is automatically enabled when something is logged with any higher level than info.
disable_log_color: boolDisable log color output.
enable_log_reloading: boolEnable feature to dynamically update and reload the log filter.
Be aware that enabling this feature can lead to a performance decrease up to factor six or more. Depending on the global logging level the performance decrease changes.
The system_addLogFilter and system_resetLogFilter RPCs will have no effect with this
option not being set.
tracing_targets: Option<String>Sets a custom profiling filter. Syntax is the same as for logging: <target>=<level>.
tracing_receiver: TracingReceiverReceiver to process tracing messages.
Implementations§
sourcepub fn base_path(&self) -> Result<Option<BasePath>, Error>
pub fn base_path(&self) -> Result<Option<BasePath>, Error>
Specify custom base path.
Examples found in repository?
More examples
484 485 486 487 488 489 490 491 492 493 494 495
fn base_path(&self) -> Result<Option<BasePath>> {
Ok(if self.tmp {
Some(BasePath::new_temp_dir()?)
} else {
match self.shared_params().base_path()? {
Some(r) => Some(r),
// If `dev` is enabled, we use the temp base path.
None if self.shared_params().is_dev() => Some(BasePath::new_temp_dir()?),
None => None,
}
})
}59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
pub fn run<C: SubstrateCli>(&self, cli: &C) -> Result<(), Error> {
let suri = utils::read_uri(self.suri.as_ref())?;
let base_path = self
.shared_params
.base_path()?
.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
let chain_id = self.shared_params.chain_id(self.shared_params.is_dev());
let chain_spec = cli.load_spec(&chain_id)?;
let config_dir = base_path.config_dir(chain_spec.id());
let (keystore, public) = match self.keystore_params.keystore_config(&config_dir)? {
(_, KeystoreConfig::Path { path, password }) => {
let public = with_crypto_scheme!(self.scheme, to_vec(&suri, password.clone()))?;
let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::open(path, password)?);
(keystore, public)
},
_ => unreachable!("keystore_config always returns path and password; qed"),
};
let key_type =
KeyTypeId::try_from(self.key_type.as_str()).map_err(|_| Error::KeyTypeInvalid)?;
SyncCryptoStore::insert_unknown(&*keystore, key_type, &suri, &public[..])
.map_err(|_| Error::KeyStoreOperation)?;
Ok(())
}sourcepub fn is_dev(&self) -> bool
pub fn is_dev(&self) -> bool
Specify the development chain.
Examples found in repository?
More examples
484 485 486 487 488 489 490 491 492 493 494 495
fn base_path(&self) -> Result<Option<BasePath>> {
Ok(if self.tmp {
Some(BasePath::new_temp_dir()?)
} else {
match self.shared_params().base_path()? {
Some(r) => Some(r),
// If `dev` is enabled, we use the temp base path.
None if self.shared_params().is_dev() => Some(BasePath::new_temp_dir()?),
None => None,
}
})
}59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
pub fn run<C: SubstrateCli>(&self, cli: &C) -> Result<(), Error> {
let suri = utils::read_uri(self.suri.as_ref())?;
let base_path = self
.shared_params
.base_path()?
.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
let chain_id = self.shared_params.chain_id(self.shared_params.is_dev());
let chain_spec = cli.load_spec(&chain_id)?;
let config_dir = base_path.config_dir(chain_spec.id());
let (keystore, public) = match self.keystore_params.keystore_config(&config_dir)? {
(_, KeystoreConfig::Path { path, password }) => {
let public = with_crypto_scheme!(self.scheme, to_vec(&suri, password.clone()))?;
let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::open(path, password)?);
(keystore, public)
},
_ => unreachable!("keystore_config always returns path and password; qed"),
};
let key_type =
KeyTypeId::try_from(self.key_type.as_str()).map_err(|_| Error::KeyTypeInvalid)?;
SyncCryptoStore::insert_unknown(&*keystore, key_type, &suri, &public[..])
.map_err(|_| Error::KeyStoreOperation)?;
Ok(())
}sourcepub fn chain_id(&self, is_dev: bool) -> String
pub fn chain_id(&self, is_dev: bool) -> String
Get the chain spec for the parameters provided
Examples found in repository?
More examples
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
pub fn run<C: SubstrateCli>(&self, cli: &C) -> Result<(), Error> {
let suri = utils::read_uri(self.suri.as_ref())?;
let base_path = self
.shared_params
.base_path()?
.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
let chain_id = self.shared_params.chain_id(self.shared_params.is_dev());
let chain_spec = cli.load_spec(&chain_id)?;
let config_dir = base_path.config_dir(chain_spec.id());
let (keystore, public) = match self.keystore_params.keystore_config(&config_dir)? {
(_, KeystoreConfig::Path { path, password }) => {
let public = with_crypto_scheme!(self.scheme, to_vec(&suri, password.clone()))?;
let keystore: SyncCryptoStorePtr = Arc::new(LocalKeystore::open(path, password)?);
(keystore, public)
},
_ => unreachable!("keystore_config always returns path and password; qed"),
};
let key_type =
KeyTypeId::try_from(self.key_type.as_str()).map_err(|_| Error::KeyTypeInvalid)?;
SyncCryptoStore::insert_unknown(&*keystore, key_type, &suri, &public[..])
.map_err(|_| Error::KeyStoreOperation)?;
Ok(())
}sourcepub fn log_filters(&self) -> &[String]
pub fn log_filters(&self) -> &[String]
Get the filters for the logging
sourcepub fn detailed_log_output(&self) -> bool
pub fn detailed_log_output(&self) -> bool
Should the detailed log output be enabled.
sourcepub fn disable_log_color(&self) -> bool
pub fn disable_log_color(&self) -> bool
Should the log color output be disabled?
sourcepub fn enable_log_reloading(&self) -> bool
pub fn enable_log_reloading(&self) -> bool
Is log reloading enabled
sourcepub fn tracing_receiver(&self) -> TracingReceiver
pub fn tracing_receiver(&self) -> TracingReceiver
Receiver to process tracing messages.
sourcepub fn tracing_targets(&self) -> Option<String>
pub fn tracing_targets(&self) -> Option<String>
Comma separated list of targets for tracing.
Trait Implementations§
source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§fn clone(&self) -> SharedParams
fn clone(&self) -> SharedParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
ArgMatches to self.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
ArgMatches to self.source§fn eq(&self, other: &SharedParams) -> bool
fn eq(&self, other: &SharedParams) -> bool
self and other values to be equal, and is used
by ==.Auto Trait Implementations§
Blanket Implementations§
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.fn __clone_box(&self, _: Private) -> *mut ()
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moresource§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.