improvements
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use std::{collections::HashMap, fs, path::Path};
|
use std::{collections::HashMap, fs};
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
@@ -23,7 +23,8 @@ pub struct Host {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read() -> Result<Config, ()> {
|
pub fn read() -> Result<Config, ()> {
|
||||||
let yaml = fs::read_to_string(Path::new("config.yaml")).unwrap_or("".to_string());
|
let path = format!("{}/config.yaml", env!("PWD"));
|
||||||
|
let yaml = fs::read_to_string(path).unwrap_or("".to_string());
|
||||||
let config: Config = match serde_yaml::from_str(&yaml) {
|
let config: Config = match serde_yaml::from_str(&yaml) {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(_) => return Err(())
|
Err(_) => return Err(())
|
||||||
|
|||||||
@@ -130,6 +130,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for handler in handles {
|
for handler in handles {
|
||||||
handler.join().unwrap();
|
handler.join().unwrap_or(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user