native client config revamping

This commit is contained in:
Jędrzej Stuczyński
2023-05-25 11:55:58 +01:00
parent aaa965937b
commit d5bc26d2e3
21 changed files with 336 additions and 354 deletions
+5 -2
View File
@@ -96,11 +96,14 @@ pub(crate) fn execute(args: &Init) {
eprintln!("Saved mixnet identity and sphinx keypairs");
}
let config_save_location = default_config_filepath(id);
let config_save_location = config.default_location();
config
.save_to_default_location()
.expect("Failed to save the config file");
eprintln!("Saved configuration file to {config_save_location:?}");
eprintln!(
"Saved configuration file to {}",
config_save_location.display()
);
eprintln!("Mixnode configuration completed.\n\n\n");
MixNode::new(config).print_node_details(args.output)
+5 -1
View File
@@ -105,8 +105,12 @@ impl Config {
Self::read_from_toml_file(default_config_filepath(id))
}
pub fn default_location(&self) -> PathBuf {
default_config_filepath(&self.mixnode.id)
}
pub fn save_to_default_location(&self) -> io::Result<()> {
let config_save_location: PathBuf = default_config_filepath(&self.mixnode.id);
let config_save_location: PathBuf = self.default_location();
save_formatted_config_to_file(self, config_save_location)
}