From edc404d6d7eca0c5ca925fa1292d86833cca22bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 26 May 2023 17:08:19 +0100 Subject: [PATCH] renamed paths to storage_paths and fixed mixnode template --- clients/native/src/client/config/mod.rs | 4 +- clients/native/src/client/mod.rs | 10 +++-- clients/native/src/commands/init.rs | 4 +- clients/socks5/src/commands/init.rs | 4 +- clients/socks5/src/commands/run.rs | 2 +- clients/socks5/src/config/mod.rs | 4 +- common/config/src/lib.rs | 11 +++--- gateway/src/commands/init.rs | 8 ++-- gateway/src/config/mod.rs | 6 +-- gateway/src/node/mod.rs | 12 +++--- mixnode/src/commands/describe.rs | 2 +- mixnode/src/commands/init.rs | 8 ++-- mixnode/src/config/mod.rs | 4 +- mixnode/src/config/template.rs | 37 +++++++------------ mixnode/src/node/mod.rs | 10 ++--- nym-api/src/coconut/dkg/controller.rs | 20 +++++----- nym-api/src/network_monitor/mod.rs | 2 +- nym-api/src/support/config/mod.rs | 12 +++--- nym-api/src/support/http/mod.rs | 2 +- .../desktop/src-tauri/src/config/mod.rs | 8 ++-- .../src-tauri/src/operations/export.rs | 4 +- nym-connect/desktop/src-tauri/src/tasks.rs | 2 +- .../network-requester/src/cli/init.rs | 4 +- .../network-requester/src/config/mod.rs | 4 +- .../network-requester/src/core.rs | 6 +-- 25 files changed, 92 insertions(+), 98 deletions(-) diff --git a/clients/native/src/client/config/mod.rs b/clients/native/src/client/config/mod.rs index 4770d0b6ba..95fb58acf0 100644 --- a/clients/native/src/client/config/mod.rs +++ b/clients/native/src/client/config/mod.rs @@ -74,7 +74,7 @@ pub struct Config { pub socket: Socket, // pub paths: CommonClientPathfinder, - pub paths: ClientPaths, + pub storage_paths: ClientPaths, pub logging: LoggingSettings, } @@ -89,7 +89,7 @@ impl Config { pub fn new>(id: S) -> Self { Config { base: BaseClientConfig::new(id.as_ref()), - paths: ClientPaths::new_default(default_data_directory(id.as_ref())), + storage_paths: ClientPaths::new_default(default_data_directory(id.as_ref())), logging: Default::default(), socket: Default::default(), } diff --git a/clients/native/src/client/mod.rs b/clients/native/src/client/mod.rs index 033b8b3d6a..277ea3806f 100644 --- a/clients/native/src/client/mod.rs +++ b/clients/native/src/client/mod.rs @@ -50,7 +50,7 @@ impl SocketClient { config: &Config, ) -> BandwidthController, PersistentStorage> { let storage = nym_credential_storage::initialise_persistent_storage( - &config.paths.common_paths.credentials_database, + &config.storage_paths.common_paths.credentials_database, ) .await; @@ -107,7 +107,7 @@ impl SocketClient { } fn key_store(&self) -> OnDiskKeys { - OnDiskKeys::new(self.config.paths.common_paths.keys_paths.clone()) + OnDiskKeys::new(self.config.storage_paths.common_paths.keys_paths.clone()) } // TODO: see if this could also be shared with socks5 client / nym-sdk maybe @@ -124,7 +124,11 @@ impl SocketClient { self.key_store(), bandwidth_controller, non_wasm_helpers::setup_fs_reply_surb_backend( - &self.config.paths.common_paths.reply_surb_database_path, + &self + .config + .storage_paths + .common_paths + .reply_surb_database_path, &self.config.base.debug.reply_surbs, ) .await?, diff --git a/clients/native/src/commands/init.rs b/clients/native/src/commands/init.rs index 88b6e3b815..8c05ce7251 100644 --- a/clients/native/src/commands/init.rs +++ b/clients/native/src/commands/init.rs @@ -163,7 +163,7 @@ pub(crate) async fn execute(args: &Init) -> Result<(), ClientError> { // Setup gateway by either registering a new one, or creating a new config from the selected // one but with keys kept, or reusing the gateway configuration. - let key_store = OnDiskKeys::new(config.paths.common_paths.keys_paths.clone()); + let key_store = OnDiskKeys::new(config.storage_paths.common_paths.keys_paths.clone()); let gateway = nym_client_core::init::setup_gateway_from_config::<_>( &key_store, register_gateway, @@ -186,7 +186,7 @@ pub(crate) async fn execute(args: &Init) -> Result<(), ClientError> { ); let address = nym_client_core::init::get_client_address_from_stored_ondisk_keys( - &config.paths.common_paths.keys_paths, + &config.storage_paths.common_paths.keys_paths, &config.base.client.gateway_endpoint, )?; diff --git a/clients/socks5/src/commands/init.rs b/clients/socks5/src/commands/init.rs index a99c64aef6..89cc6f1e10 100644 --- a/clients/socks5/src/commands/init.rs +++ b/clients/socks5/src/commands/init.rs @@ -169,7 +169,7 @@ pub(crate) async fn execute(args: &Init) -> Result<(), Socks5ClientError> { // Setup gateway by either registering a new one, or creating a new config from the selected // one but with keys kept, or reusing the gateway configuration. - let key_store = OnDiskKeys::new(config.paths.common_paths.keys_paths.clone()); + let key_store = OnDiskKeys::new(config.storage_paths.common_paths.keys_paths.clone()); let gateway = nym_client_core::init::setup_gateway_from_config::<_>( &key_store, register_gateway, @@ -194,7 +194,7 @@ pub(crate) async fn execute(args: &Init) -> Result<(), Socks5ClientError> { ); let address = nym_client_core::init::get_client_address_from_stored_ondisk_keys( - &config.paths.common_paths.keys_paths, + &config.storage_paths.common_paths.keys_paths, &config.core.base.client.gateway_endpoint, )?; let init_results = InitResults::new(&config, &address); diff --git a/clients/socks5/src/commands/run.rs b/clients/socks5/src/commands/run.rs index ccc87e47d6..974c40a5f6 100644 --- a/clients/socks5/src/commands/run.rs +++ b/clients/socks5/src/commands/run.rs @@ -140,6 +140,6 @@ pub(crate) async fn execute(args: &Run) -> Result<(), Box>(id: S, provider_mix_address: S) -> Self { Config { core: CoreConfig::new(id.as_ref(), provider_mix_address.as_ref()), - paths: SocksClientPaths::new_default(default_data_directory(id.as_ref())), + storage_paths: SocksClientPaths::new_default(default_data_directory(id.as_ref())), logging: Default::default(), } } diff --git a/common/config/src/lib.rs b/common/config/src/lib.rs index 84520ebc92..86fec922ef 100644 --- a/common/config/src/lib.rs +++ b/common/config/src/lib.rs @@ -44,11 +44,12 @@ pub trait NymConfigTemplate: Serialize { if let Err(err) = Handlebars::new().render_template_to_write(Self::template(), &self, writer) { - if let TemplateRenderError::IOError(err, _) = err { - return Err(err); - } else { - // it is responsibility of whoever is implementing the trait to ensure the template is valid - panic!("invalid template") + match err { + TemplateRenderError::IOError(err, _) => return Err(err), + other_err => { + // it is responsibility of whoever is implementing the trait to ensure the template is valid + panic!("invalid template: {other_err}") + } } } diff --git a/gateway/src/commands/init.rs b/gateway/src/commands/init.rs index 59fd5cad59..2901e116ef 100644 --- a/gateway/src/commands/init.rs +++ b/gateway/src/commands/init.rs @@ -127,8 +127,8 @@ pub async fn execute(args: Init) -> Result<(), Box> { nym_pemstore::store_keypair( &identity_keys, &nym_pemstore::KeyPairPath::new( - config.paths.private_identity_key(), - config.paths.public_identity_key(), + config.storage_paths.private_identity_key(), + config.storage_paths.public_identity_key(), ), ) .expect("Failed to save identity keys"); @@ -136,8 +136,8 @@ pub async fn execute(args: Init) -> Result<(), Box> { nym_pemstore::store_keypair( &sphinx_keys, &nym_pemstore::KeyPairPath::new( - config.paths.private_encryption_key(), - config.paths.public_encryption_key(), + config.storage_paths.private_encryption_key(), + config.storage_paths.public_encryption_key(), ), ) .expect("Failed to save sphinx keys"); diff --git a/gateway/src/config/mod.rs b/gateway/src/config/mod.rs index caf4f576a5..ad75ff3b3d 100644 --- a/gateway/src/config/mod.rs +++ b/gateway/src/config/mod.rs @@ -66,7 +66,7 @@ pub fn default_data_directory>(id: P) -> PathBuf { pub struct Config { pub gateway: Gateway, - pub paths: GatewayPaths, + pub storage_paths: GatewayPaths, #[serde(default)] pub logging: LoggingSettings, @@ -85,7 +85,7 @@ impl Config { pub fn new>(id: S) -> Self { Config { gateway: Gateway::new_default(id.as_ref()), - paths: GatewayPaths::new_default(id.as_ref()), + storage_paths: GatewayPaths::new_default(id.as_ref()), logging: Default::default(), debug: Default::default(), } @@ -154,7 +154,7 @@ impl Config { } pub fn with_custom_persistent_store(mut self, store_dir: PathBuf) -> Self { - self.paths.clients_storage = store_dir; + self.storage_paths.clients_storage = store_dir; self } diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index 9173a0a8b2..e583b975c1 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -37,7 +37,7 @@ pub(crate) async fn create_gateway(config: Config) -> Gateway } async fn initialise_storage(config: &Config) -> PersistentStorage { - let path = &config.paths.clients_storage; + let path = &config.storage_paths.clients_storage; let retrieval_limit = config.debug.message_retrieval_limit; match PersistentStorage::init(path, retrieval_limit).await { Err(err) => panic!("failed to initialise gateway storage: {err}"), @@ -84,8 +84,8 @@ impl Gateway { pub(crate) fn load_identity_keys(config: &Config) -> identity::KeyPair { let identity_keypair: identity::KeyPair = nym_pemstore::load_keypair(&nym_pemstore::KeyPairPath::new( - config.paths.keys.private_identity_key(), - config.paths.keys.public_identity_key(), + config.storage_paths.keys.private_identity_key(), + config.storage_paths.keys.public_identity_key(), )) .expect("Failed to read stored identity key files"); identity_keypair @@ -95,8 +95,8 @@ impl Gateway { fn load_sphinx_keys(config: &Config) -> encryption::KeyPair { let sphinx_keypair: encryption::KeyPair = nym_pemstore::load_keypair(&nym_pemstore::KeyPairPath::new( - config.paths.keys.private_encryption_key(), - config.paths.keys.public_encryption_key(), + config.storage_paths.keys.private_encryption_key(), + config.storage_paths.keys.public_encryption_key(), )) .expect("Failed to read stored sphinx key files"); sphinx_keypair @@ -110,7 +110,7 @@ impl Gateway { version: self.config.gateway.version.clone(), mix_port: self.config.gateway.mix_port, clients_port: self.config.gateway.clients_port, - data_store: self.config.paths.clients_storage.display().to_string(), + data_store: self.config.storage_paths.clients_storage.display().to_string(), }; println!("{}", output.format(&node_details)); diff --git a/mixnode/src/commands/describe.rs b/mixnode/src/commands/describe.rs index 8cc8551840..110088b78e 100644 --- a/mixnode/src/commands/describe.rs +++ b/mixnode/src/commands/describe.rs @@ -80,5 +80,5 @@ pub(crate) fn execute(args: Describe) { }; // save the struct - NodeDescription::save_to_file(&node_description, config.paths.node_description).unwrap() + NodeDescription::save_to_file(&node_description, config.storage_paths.node_description).unwrap() } diff --git a/mixnode/src/commands/init.rs b/mixnode/src/commands/init.rs index 1bea6e1721..03c6e2cd2b 100644 --- a/mixnode/src/commands/init.rs +++ b/mixnode/src/commands/init.rs @@ -88,8 +88,8 @@ pub(crate) fn execute(args: &Init) { nym_pemstore::store_keypair( &identity_keys, &nym_pemstore::KeyPairPath::new( - config.paths.private_identity_key(), - config.paths.public_identity_key(), + config.storage_paths.private_identity_key(), + config.storage_paths.public_identity_key(), ), ) .expect("Failed to save identity keys"); @@ -97,8 +97,8 @@ pub(crate) fn execute(args: &Init) { nym_pemstore::store_keypair( &sphinx_keys, &nym_pemstore::KeyPairPath::new( - config.paths.private_encryption_key(), - config.paths.public_encryption_key(), + config.storage_paths.private_encryption_key(), + config.storage_paths.public_encryption_key(), ), ) .expect("Failed to save sphinx keys"); diff --git a/mixnode/src/config/mod.rs b/mixnode/src/config/mod.rs index c2b49a03de..cd3dc423c9 100644 --- a/mixnode/src/config/mod.rs +++ b/mixnode/src/config/mod.rs @@ -74,7 +74,7 @@ pub fn default_data_directory>(id: P) -> PathBuf { pub struct Config { pub mixnode: MixNode, - pub paths: MixNodePaths, + pub storage_paths: MixNodePaths, #[serde(default)] pub verloc: Verloc, @@ -96,7 +96,7 @@ impl Config { pub fn new>(id: S) -> Self { Config { mixnode: MixNode::new_default(id.as_ref()), - paths: MixNodePaths::new_default(id.as_ref()), + storage_paths: MixNodePaths::new_default(id.as_ref()), verloc: Default::default(), logging: Default::default(), debug: Default::default(), diff --git a/mixnode/src/config/template.rs b/mixnode/src/config/template.rs index ac610033e7..a885a1ecbb 100644 --- a/mixnode/src/config/template.rs +++ b/mixnode/src/config/template.rs @@ -21,25 +21,6 @@ id = '{{ mixnode.id }}' # Socket address to which this mixnode will bind to and will be listening for packets. listening_address = '{{ mixnode.listening_address }}' -# Path to file containing private identity key. -private_identity_key_file = '{{ mixnode.private_identity_key_file }}' - -# Path to file containing public identity key. -public_identity_key_file = '{{ mixnode.public_identity_key_file }}' - -# Path to file containing private identity key. -private_sphinx_key_file = '{{ mixnode.private_sphinx_key_file }}' - -# Path to file containing public sphinx key. -public_sphinx_key_file = '{{ mixnode.public_sphinx_key_file }}' - -##### additional mixnode config options ##### - -# Optional address announced to the directory server for the clients to connect to. -# It is useful, say, in NAT scenarios or wanting to more easily update actual IP address -# later on by using name resolvable with a DNS query, such as `nymtech.net`. -announce_address = '{{ mixnode.announce_address }}' - # Port used for listening for all mixnet traffic. # (default: 1789) mix_port = {{ mixnode.mix_port }} @@ -59,14 +40,22 @@ nym_api_urls = [ {{/each}} ] -# Nym wallet address on the blockchain that should control this mixnode -wallet_address = '{{ mixnode.wallet_address }}' +[storage_paths] -##### advanced configuration options ##### +# Path to file containing private identity key. +keys.private_identity_key_file = '{{ storage_paths.keys.private_identity_key_file }}' -# Absolute path to the home Nym Clients directory. -nym_root_directory = '{{ mixnode.nym_root_directory }}' +# Path to file containing public identity key. +keys.public_identity_key_file = '{{ storage_paths.keys.public_identity_key_file }}' +# Path to file containing private identity key. +keys.private_sphinx_key_file = '{{ storage_paths.keys.private_sphinx_key_file }}' + +# Path to file containing public sphinx key. +keys.public_sphinx_key_file = '{{ storage_paths.keys.public_sphinx_key_file }}' + +# Path to file containing description of this node. +node_description = '{{ storage_paths.node_description }}' ##### logging configuration options ##### diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index 3274e91fcd..a6571adbd5 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -54,15 +54,15 @@ impl MixNode { } fn load_node_description(config: &Config) -> NodeDescription { - NodeDescription::load_from_file(&config.paths.node_description).unwrap_or_default() + NodeDescription::load_from_file(&config.storage_paths.node_description).unwrap_or_default() } /// Loads identity keys stored on disk pub(crate) fn load_identity_keys(config: &Config) -> identity::KeyPair { let identity_keypair: identity::KeyPair = nym_pemstore::load_keypair(&nym_pemstore::KeyPairPath::new( - config.paths.keys.private_identity_key(), - config.paths.keys.public_identity_key(), + config.storage_paths.keys.private_identity_key(), + config.storage_paths.keys.public_identity_key(), )) .expect("Failed to read stored identity key files"); identity_keypair @@ -72,8 +72,8 @@ impl MixNode { fn load_sphinx_keys(config: &Config) -> encryption::KeyPair { let sphinx_keypair: encryption::KeyPair = nym_pemstore::load_keypair(&nym_pemstore::KeyPairPath::new( - config.paths.keys.private_encryption_key(), - config.paths.keys.public_encryption_key(), + config.storage_paths.keys.private_encryption_key(), + config.storage_paths.keys.public_encryption_key(), )) .expect("Failed to read stored sphinx key files"); sphinx_keypair diff --git a/nym-api/src/coconut/dkg/controller.rs b/nym-api/src/coconut/dkg/controller.rs index 9942f5b560..027b8d2800 100644 --- a/nym-api/src/coconut/dkg/controller.rs +++ b/nym-api/src/coconut/dkg/controller.rs @@ -30,8 +30,8 @@ pub(crate) fn init_keypair(config: &config::CoconutSigner) -> Result<()> { nym_pemstore::store_keypair( &kp, &nym_pemstore::KeyPairPath::new( - &config.paths.decryption_key_path, - &config.paths.public_key_with_proof_path, + &config.storage_paths.decryption_key_path, + &config.storage_paths.public_key_with_proof_path, ), )?; Ok(()) @@ -54,27 +54,27 @@ impl DkgController { rng: R, ) -> Result { let dkg_keypair = nym_pemstore::load_keypair(&nym_pemstore::KeyPairPath::new( - &config.paths.decryption_key_path, - &config.paths.public_key_with_proof_path, + &config.storage_paths.decryption_key_path, + &config.storage_paths.public_key_with_proof_path, ))?; if let Ok(coconut_keypair_value) = nym_pemstore::load_keypair(&nym_pemstore::KeyPairPath::new( - &config.paths.secret_key_path, - &config.paths.verification_key_path, + &config.storage_paths.secret_key_path, + &config.storage_paths.verification_key_path, )) { coconut_keypair.set(Some(coconut_keypair_value)).await; } let persistent_state = - PersistentState::load_from_file(&config.paths.dkg_persistent_state_path) + PersistentState::load_from_file(&config.storage_paths.dkg_persistent_state_path) .unwrap_or_default(); Ok(DkgController { dkg_client: DkgClient::new(nyxd_client), - secret_key_path: config.paths.secret_key_path.clone(), - verification_key_path: config.paths.verification_key_path.clone(), + secret_key_path: config.storage_paths.secret_key_path.clone(), + verification_key_path: config.storage_paths.verification_key_path.clone(), state: State::new( - config.paths.dkg_persistent_state_path.clone(), + config.storage_paths.dkg_persistent_state_path.clone(), persistent_state, config.announce_address.clone(), dkg_keypair, diff --git a/nym-api/src/network_monitor/mod.rs b/nym-api/src/network_monitor/mod.rs index fc6dde04b2..ae49caf020 100644 --- a/nym-api/src/network_monitor/mod.rs +++ b/nym-api/src/network_monitor/mod.rs @@ -94,7 +94,7 @@ impl<'a> NetworkMonitorBuilder<'a> { let bandwidth_controller = { BandwidthController::new( nym_credential_storage::initialise_persistent_storage( - &self.config.paths.credentials_database_path, + &self.config.storage_paths.credentials_database_path, ) .await, self.nyxd_client.clone(), diff --git a/nym-api/src/support/config/mod.rs b/nym-api/src/support/config/mod.rs index bd2002f3fb..4afe798451 100644 --- a/nym-api/src/support/config/mod.rs +++ b/nym-api/src/support/config/mod.rs @@ -255,7 +255,7 @@ pub struct NetworkMonitor { pub enabled: bool, #[serde(flatten)] - pub paths: NetworkMonitorPaths, + pub storage_paths: NetworkMonitorPaths, #[serde(flatten)] pub debug: NetworkMonitorDebug, @@ -265,7 +265,7 @@ impl NetworkMonitor { pub fn new_default>(id: P) -> Self { NetworkMonitor { enabled: false, - paths: NetworkMonitorPaths::new_default(id), + storage_paths: NetworkMonitorPaths::new_default(id), debug: Default::default(), } } @@ -351,7 +351,7 @@ impl Default for NetworkMonitorDebug { pub struct NodeStatusAPI { // pub enabled: bool, #[serde(flatten)] - pub paths: NodeStatusAPIPaths, + pub storage_paths: NodeStatusAPIPaths, #[serde(flatten)] pub debug: NodeStatusAPIDebug, @@ -360,7 +360,7 @@ pub struct NodeStatusAPI { impl NodeStatusAPI { pub fn new_default>(id: P) -> Self { NodeStatusAPI { - paths: NodeStatusAPIPaths::new_default(id), + storage_paths: NodeStatusAPIPaths::new_default(id), debug: Default::default(), } } @@ -489,7 +489,7 @@ pub struct CoconutSigner { pub announce_address: Url, #[serde(flatten)] - pub paths: CoconutSignerPaths, + pub storage_paths: CoconutSignerPaths, #[serde(flatten)] pub debug: CoconutSignerDebug, @@ -508,7 +508,7 @@ impl CoconutSigner { CoconutSigner { enabled: false, announce_address: default_announce_address, - paths: CoconutSignerPaths::new_default(id), + storage_paths: CoconutSignerPaths::new_default(id), debug: Default::default(), } } diff --git a/nym-api/src/support/http/mod.rs b/nym-api/src/support/http/mod.rs index c6cf8ab508..b2505b9ab4 100644 --- a/nym-api/src/support/http/mod.rs +++ b/nym-api/src/support/http/mod.rs @@ -46,7 +46,7 @@ pub(crate) async fn setup_rocket( // This is not a very nice approach. A lazy value would be more suitable, but that's still // a nightly feature: https://github.com/rust-lang/rust/issues/74465 let storage = if config.coconut_signer.enabled || config.network_monitor.enabled { - Some(storage::NymApiStorage::init(&config.node_status_api.paths.database_path).await?) + Some(storage::NymApiStorage::init(&config.node_status_api.storage_paths.database_path).await?) } else { None }; diff --git a/nym-connect/desktop/src-tauri/src/config/mod.rs b/nym-connect/desktop/src-tauri/src/config/mod.rs index 8564b6312b..2d002a4333 100644 --- a/nym-connect/desktop/src-tauri/src/config/mod.rs +++ b/nym-connect/desktop/src-tauri/src/config/mod.rs @@ -54,7 +54,7 @@ pub fn default_data_directory>(id: P) -> PathBuf { pub struct Config { pub socks5: Socks5CoreConfig, - pub paths: NymConnectPaths, + pub storage_paths: NymConnectPaths, } impl NymConfigTemplate for Config { @@ -71,7 +71,7 @@ impl Config { pub fn new>(id: S, provider_mix_address: S) -> Self { Config { socks5: Socks5CoreConfig::new(id.as_ref(), provider_mix_address.as_ref()), - paths: NymConnectPaths::new_default(default_data_directory(id.as_ref())), + storage_paths: NymConnectPaths::new_default(default_data_directory(id.as_ref())), } } @@ -154,7 +154,7 @@ pub async fn init_socks5_config(provider_address: String, chosen_gateway_id: Str .map_err(|_| BackendError::UnableToParseGateway)?; // Setup gateway by either registering a new one, or reusing exiting keys - let key_store = OnDiskKeys::new(config.paths.common_paths.keys_paths.clone()); + let key_store = OnDiskKeys::new(config.storage_paths.common_paths.keys_paths.clone()); let gateway = nym_client_core::init::setup_gateway_from_config::<_>( &key_store, register_gateway, @@ -175,7 +175,7 @@ pub async fn init_socks5_config(provider_address: String, chosen_gateway_id: Str print_saved_config(&config); let address = nym_client_core::init::get_client_address_from_stored_ondisk_keys( - &config.paths.common_paths.keys_paths, + &config.storage_paths.common_paths.keys_paths, &config.socks5.base.client.gateway_endpoint, )?; log::info!("The address of this client is: {}", address); diff --git a/nym-connect/desktop/src-tauri/src/operations/export.rs b/nym-connect/desktop/src-tauri/src/operations/export.rs index 02f323fb58..33853ded87 100644 --- a/nym-connect/desktop/src-tauri/src/operations/export.rs +++ b/nym-connect/desktop/src-tauri/src/operations/export.rs @@ -20,7 +20,7 @@ pub async fn get_identity_key( state.load_config()? }; - let paths = config.paths.common_paths.keys_paths; + let paths = config.storage_paths.common_paths.keys_paths; // wtf, why are we loading EVERYTHING to just get identity key?? let key_store = OnDiskKeys::from(paths); @@ -52,7 +52,7 @@ pub async fn export_keys(state: tauri::State<'_, Arc>>) -> Result< state.load_config()? }; - let key_paths = config.paths.common_paths.keys_paths; + let key_paths = config.storage_paths.common_paths.keys_paths; // Get key paths let ack_key_file = key_paths.ack_key(); diff --git a/nym-connect/desktop/src-tauri/src/tasks.rs b/nym-connect/desktop/src-tauri/src/tasks.rs index dc17bf9523..2b298a90f2 100644 --- a/nym-connect/desktop/src-tauri/src/tasks.rs +++ b/nym-connect/desktop/src-tauri/src/tasks.rs @@ -62,7 +62,7 @@ pub fn start_nym_socks5_client( .expect("Failed to create runtime for SOCKS5 client") .block_on(async move { let storage = OnDiskPersistent::from_paths( - config.paths.common_paths, + config.storage_paths.common_paths, &config.socks5.base.debug, ) .await?; diff --git a/service-providers/network-requester/src/cli/init.rs b/service-providers/network-requester/src/cli/init.rs index f241193111..1ed2bbb7d1 100644 --- a/service-providers/network-requester/src/cli/init.rs +++ b/service-providers/network-requester/src/cli/init.rs @@ -137,7 +137,7 @@ pub(crate) async fn execute(args: &Init) -> Result<(), NetworkRequesterError> { // Setup gateway by either registering a new one, or creating a new config from the selected // one but with keys kept, or reusing the gateway configuration. - let key_store = OnDiskKeys::new(config.paths.common_paths.keys_paths.clone()); + let key_store = OnDiskKeys::new(config.storage_paths.common_paths.keys_paths.clone()); let gateway = nym_client_core::init::setup_gateway_from_config::<_>( &key_store, register_gateway, @@ -163,7 +163,7 @@ pub(crate) async fn execute(args: &Init) -> Result<(), NetworkRequesterError> { ); let address = nym_client_core::init::get_client_address_from_stored_ondisk_keys( - &config.paths.common_paths.keys_paths, + &config.storage_paths.common_paths.keys_paths, &config.base.client.gateway_endpoint, )?; diff --git a/service-providers/network-requester/src/config/mod.rs b/service-providers/network-requester/src/config/mod.rs index 3aaf600447..c88e5fb751 100644 --- a/service-providers/network-requester/src/config/mod.rs +++ b/service-providers/network-requester/src/config/mod.rs @@ -64,7 +64,7 @@ pub struct Config { // alias due to backwards compatibility #[serde(alias = "network_requester")] - pub paths: NetworkRequesterPaths, + pub storage_paths: NetworkRequesterPaths, #[serde(default)] pub network_requester_debug: Debug, @@ -81,7 +81,7 @@ impl Config { Config { base: BaseClientConfig::new(id.as_ref()), network_requester_config: Default::default(), - paths: NetworkRequesterPaths::new_default(default_data_directory(id.as_ref())), + storage_paths: NetworkRequesterPaths::new_default(default_data_directory(id.as_ref())), network_requester_debug: Default::default(), } } diff --git a/service-providers/network-requester/src/core.rs b/service-providers/network-requester/src/core.rs index 489f677ccc..2b934863a3 100644 --- a/service-providers/network-requester/src/core.rs +++ b/service-providers/network-requester/src/core.rs @@ -164,8 +164,8 @@ impl NRServiceProviderBuilder { ) -> NRServiceProviderBuilder { let standard_list = StandardList::new(); - let allowed_hosts = StoredAllowedHosts::new(&config.paths.allowed_list_location); - let unknown_hosts = allowed_hosts::HostsStore::new(&config.paths.unknown_list_location); + let allowed_hosts = StoredAllowedHosts::new(&config.storage_paths.allowed_list_location); + let unknown_hosts = allowed_hosts::HostsStore::new(&config.storage_paths.unknown_list_location); let outbound_request_filter = OutboundRequestFilter::new(allowed_hosts.clone(), standard_list.clone(), unknown_hosts); @@ -185,7 +185,7 @@ impl NRServiceProviderBuilder { pub async fn run_service_provider(self) -> Result<(), NetworkRequesterError> { // Connect to the mixnet let mixnet_client = - create_mixnet_client(&self.config.base, &self.config.paths.common_paths).await?; + create_mixnet_client(&self.config.base, &self.config.storage_paths.common_paths).await?; // channels responsible for managing messages that are to be sent to the mix network. The receiver is // going to be used by `mixnet_response_listener`