mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 23:57:56 +00:00
Fix base-path handling in key insert (#7775)
This fixes the handling of base-path when using `key insert`. Before the base-path wasn't setup correctly, as done when starting a node. This resulted in putting the keys into the wrong directory. This pr fixes this by creating the correct base-path/config dir for the keystore. Besides that it also removes the insert command from `subkey` as it doesn't make that much sense. If requested, we could bring it back later.
This commit is contained in:
@@ -186,11 +186,11 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
||||
|
||||
/// Get the keystore configuration.
|
||||
///
|
||||
/// Bu default this is retrieved from `KeystoreParams` if it is available. Otherwise it uses
|
||||
/// By default this is retrieved from `KeystoreParams` if it is available. Otherwise it uses
|
||||
/// `KeystoreConfig::InMemory`.
|
||||
fn keystore_config(&self, base_path: &PathBuf) -> Result<(Option<String>, KeystoreConfig)> {
|
||||
fn keystore_config(&self, config_dir: &PathBuf) -> Result<(Option<String>, KeystoreConfig)> {
|
||||
self.keystore_params()
|
||||
.map(|x| x.keystore_config(base_path))
|
||||
.map(|x| x.keystore_config(config_dir))
|
||||
.unwrap_or_else(|| Ok((None, KeystoreConfig::InMemory)))
|
||||
}
|
||||
|
||||
@@ -454,15 +454,11 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
||||
) -> Result<Configuration> {
|
||||
let is_dev = self.is_dev()?;
|
||||
let chain_id = self.chain_id(is_dev)?;
|
||||
let chain_spec = cli.load_spec(chain_id.as_str())?;
|
||||
let chain_spec = cli.load_spec(&chain_id)?;
|
||||
let base_path = self
|
||||
.base_path()?
|
||||
.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
|
||||
let config_dir = base_path
|
||||
.path()
|
||||
.to_path_buf()
|
||||
.join("chains")
|
||||
.join(chain_spec.id());
|
||||
let config_dir = base_path.config_dir(chain_spec.id());
|
||||
let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH);
|
||||
let client_id = C::client_id();
|
||||
let database_cache_size = self.database_cache_size()?.unwrap_or(128);
|
||||
|
||||
Reference in New Issue
Block a user