fixed eda61b57dc8d349a9b0af70cbd02743eba1e10bf
This commit is contained in:
@@ -5,6 +5,7 @@ use crate::config::default_config_filepath;
|
||||
use crate::config::old_config_v1::ConfigV1;
|
||||
use crate::error::IpPacketRouterError;
|
||||
use log::{info, trace};
|
||||
use nym_client_core::cli_helpers::CliClientConfig;
|
||||
use nym_client_core::client::base_client::storage::migration_helpers::v1_1_33;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -12,7 +13,7 @@ async fn try_upgrade_v1_config<P: AsRef<Path>>(
|
||||
config_path: P,
|
||||
) -> Result<bool, IpPacketRouterError> {
|
||||
// explicitly load it as v1 (which is incompatible with the current one)
|
||||
let Ok(old_config) = ConfigV1::read_from_toml_file(config_path) else {
|
||||
let Ok(old_config) = ConfigV1::read_from_toml_file(config_path.as_ref()) else {
|
||||
// if we failed to load it, there might have been nothing to upgrade
|
||||
// or maybe it was an even older file. in either way. just ignore it and carry on with our day
|
||||
return Ok(false);
|
||||
@@ -30,7 +31,7 @@ async fn try_upgrade_v1_config<P: AsRef<Path>>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
updated.save_to_default_location()?;
|
||||
updated.save_to(config_path)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::config::old_config_v1_1_20_2::ConfigV1_1_20_2;
|
||||
use crate::config::old_config_v1_1_33::ConfigV1_1_33;
|
||||
use crate::error::NetworkRequesterError;
|
||||
use log::{info, trace};
|
||||
use nym_client_core::cli_helpers::CliClientConfig;
|
||||
use nym_client_core::client::base_client::storage::migration_helpers::v1_1_33;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -18,7 +19,7 @@ async fn try_upgrade_v1_1_13_config<P: AsRef<Path>>(
|
||||
use nym_config::legacy_helpers::nym_config::MigrationNymConfig;
|
||||
|
||||
// explicitly load it as v1.1.13 (which is incompatible with the next step, i.e. 1.1.19)
|
||||
let Ok(old_config) = OldConfigV1_1_13::load_from_filepath(config_path) else {
|
||||
let Ok(old_config) = OldConfigV1_1_13::load_from_filepath(config_path.as_ref()) else {
|
||||
// if we failed to load it, there might have been nothing to upgrade
|
||||
// or maybe it was an even older file. in either way. just ignore it and carry on with our day
|
||||
return Ok(false);
|
||||
@@ -39,7 +40,7 @@ async fn try_upgrade_v1_1_13_config<P: AsRef<Path>>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
updated.save_to_default_location()?;
|
||||
updated.save_to(config_path)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ async fn try_upgrade_v1_1_20_config<P: AsRef<Path>>(
|
||||
use nym_config::legacy_helpers::nym_config::MigrationNymConfig;
|
||||
|
||||
// explicitly load it as v1.1.20 (which is incompatible with the current one, i.e. +1.1.21)
|
||||
let Ok(old_config) = ConfigV1_1_20::load_from_filepath(config_path) else {
|
||||
let Ok(old_config) = ConfigV1_1_20::load_from_filepath(config_path.as_ref()) else {
|
||||
// if we failed to load it, there might have been nothing to upgrade
|
||||
// or maybe it was an even older file. in either way. just ignore it and carry on with our day
|
||||
return Ok(false);
|
||||
@@ -71,7 +72,7 @@ async fn try_upgrade_v1_1_20_config<P: AsRef<Path>>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
updated.save_to_default_location()?;
|
||||
updated.save_to(config_path)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ async fn try_upgrade_v1_1_20_2_config<P: AsRef<Path>>(
|
||||
trace!("Trying to load as v1.1.20_2 config");
|
||||
|
||||
// explicitly load it as v1.1.20_2 (which is incompatible with the current one, i.e. +1.1.21)
|
||||
let Ok(old_config) = ConfigV1_1_20_2::read_from_toml_file(config_path) else {
|
||||
let Ok(old_config) = ConfigV1_1_20_2::read_from_toml_file(config_path.as_ref()) else {
|
||||
// if we failed to load it, there might have been nothing to upgrade
|
||||
// or maybe it was an even older file. in either way. just ignore it and carry on with our day
|
||||
return Ok(false);
|
||||
@@ -100,15 +101,17 @@ async fn try_upgrade_v1_1_20_2_config<P: AsRef<Path>>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
updated.save_to_default_location()?;
|
||||
updated.save_to(config_path)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
async fn try_upgrade_v1_1_33_config<P: AsRef<Path>>(
|
||||
config_path: P,
|
||||
) -> Result<bool, NetworkRequesterError> {
|
||||
trace!("Trying to load as v1.1.33 config");
|
||||
|
||||
// explicitly load it as v1.1.33 (which is incompatible with the current one, i.e. +1.1.34)
|
||||
let Ok(old_config) = ConfigV1_1_33::read_from_toml_file(config_path) else {
|
||||
let Ok(old_config) = ConfigV1_1_33::read_from_toml_file(config_path.as_ref()) else {
|
||||
// if we failed to load it, there might have been nothing to upgrade
|
||||
// or maybe it was an even older file. in either way. just ignore it and carry on with our day
|
||||
return Ok(false);
|
||||
@@ -126,7 +129,7 @@ async fn try_upgrade_v1_1_33_config<P: AsRef<Path>>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
updated.save_to_default_location()?;
|
||||
updated.save_to(config_path)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ pub struct NetworkRequesterPathsV1_1_33 {
|
||||
#[derive(Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ConfigV1_1_33 {
|
||||
#[serde(flatten)]
|
||||
pub base: BaseConfigV1_1_33,
|
||||
|
||||
#[serde(default)]
|
||||
|
||||
Reference in New Issue
Block a user