packaging and bootstrap work

This commit is contained in:
John Smith
2022-05-17 16:55:53 -04:00
parent ef1f5d7b52
commit 1326424eae
17 changed files with 373 additions and 60 deletions
+12 -5
View File
@@ -1,6 +1,7 @@
use crate::settings::*;
use clap::{Arg, ArgMatches, Command};
use std::ffi::OsStr;
use std::path::Path;
use std::str::FromStr;
use veilid_core::{DHTKey, DHTKeySecret};
@@ -133,12 +134,18 @@ pub fn process_command_line() -> Result<(Settings, ArgMatches), String> {
}
// Attempt to load configuration
let settings = Settings::new(if matches.occurrences_of("config-file") == 0 {
None
let settings_path = if let Some(config_file) = matches.value_of_os("config-file") {
if Path::new(config_file).exists() {
Some(config_file)
} else {
None
}
} else {
Some(matches.value_of_os("config-file").unwrap())
})
.map_err(|e| format!("configuration is invalid: {}", e))?;
None
};
let settings =
Settings::new(settings_path).map_err(|e| format!("configuration is invalid: {}", e))?;
// write lock the settings
let mut settingsrw = settings.write();