Changed settings format file from JSON to Toml.

This commit is contained in:
Revertron
2021-03-06 22:40:19 +01:00
parent c5d20d2e00
commit ac915a1e92
5 changed files with 21 additions and 26 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ use alfis::dns::protocol::DnsRecord;
use alfis::blockchain::filter::BlockchainFilter;
const KEYSTORE_DIFFICULTY: usize = 24;
const SETTINGS_FILENAME: &str = "alfis.cfg";
const SETTINGS_FILENAME: &str = "alfis.toml";
const LOG_TARGET_MAIN: &str = "alfis::Main";
const LOG_TARGET_UI: &str = "alfis::UI";
+3 -5
View File
@@ -26,12 +26,10 @@ impl Settings {
Ok(mut file) => {
let mut text = String::new();
file.read_to_string(&mut text).unwrap();
let loaded = serde_json::from_str(&text);
return if loaded.is_ok() {
Some(loaded.unwrap())
} else {
None
if let Ok(settings) = toml::from_str(&text) {
return Some(settings);
}
None
},
Err(..) => None
}