[Mig] storage to SQLite pool
[Clean] split message handler dispatch
This commit is contained in:
parent
9b20d159b5
commit
3be1d9f308
18 changed files with 1949 additions and 1700 deletions
|
|
@ -51,17 +51,17 @@ impl Default for IotaConfig {
|
|||
}
|
||||
|
||||
pub fn load_config() {
|
||||
let s = load_file("", "config.json");
|
||||
let s = load_file("", "config.yaml");
|
||||
if s.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
match serde_json::from_str::<IotaConfig>(&s) {
|
||||
match serde_yaml::from_str::<IotaConfig>(&s) {
|
||||
Ok(parsed) => {
|
||||
CONFIG.store(Arc::new(parsed));
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to parse config.json: {}. Content: '{}'", e, s);
|
||||
eprintln!("Failed to parse config.yaml: {}. Content: '{}'", e, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -72,8 +72,8 @@ pub fn clear_config() {
|
|||
}
|
||||
|
||||
pub fn save_config() {
|
||||
if let Ok(json) = serde_json::to_string(&**CONFIG.load()) {
|
||||
save_file("", "config.json", &json);
|
||||
if let Ok(yaml) = serde_yaml::to_string(&**CONFIG.load()) {
|
||||
save_file("", "config.yaml", &yaml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue