Skip to content

Commit

Permalink
All apps now start with the network in the base_path
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed Apr 11, 2023
1 parent e720fea commit 66a29fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
29 changes: 16 additions & 13 deletions applications/tari_app_utilities/src/common_cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ impl CommonCliArgs {
if config_path.is_absolute() {
config_path
} else {
let mut base_path = PathBuf::from(&self.base_path);
base_path.push(config_path);
base_path
self.get_base_path().join(config_path)
}
}

pub fn get_base_path(&self) -> PathBuf {
PathBuf::from(&self.base_path)
let network = self.network.unwrap_or_default();
PathBuf::from(&self.base_path).join(network.to_string())
}

pub fn log_config_path(&self, application_name: &str) -> PathBuf {
Expand All @@ -94,24 +93,28 @@ impl CommonCliArgs {
if path.is_absolute() {
log_config.clone()
} else {
let mut base_path = PathBuf::from(&self.base_path);
base_path.push(log_config);
base_path
self.get_base_path().join(log_config)
}
} else {
let mut path = PathBuf::from(&self.base_path);
path.push("config");
path.push(application_name);
path.push("log4rs.yml");
path
self.get_base_path()
.join("config")
.join(application_name)
.join("log4rs.yml")
}
}
}

impl ConfigOverrideProvider for CommonCliArgs {
fn get_config_property_overrides(&self, _default_network: Network) -> Vec<(String, String)> {
let mut overrides = self.config_property_overrides.clone();
overrides.push(("common.base_path".to_string(), self.base_path.clone()));
overrides.push((
"common.base_path".to_string(),
self.get_base_path()
.as_os_str()
.to_str()
.expect("An os string from a path")
.into(),
));
overrides
}
}
Expand Down
3 changes: 0 additions & 3 deletions applications/tari_base_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ fn main_inner() -> Result<(), ExitError> {
);

let mut config = ApplicationConfig::load_from(&cfg)?;
if let Some(network) = cli.network {
config.base_node.network = network;
}
debug!(target: LOG_TARGET, "Using base node configuration: {:?}", config);

// Load or create the Node identity
Expand Down

0 comments on commit 66a29fe

Please sign in to comment.