improvements

This commit is contained in:
2023-05-10 23:21:58 +02:00
parent 8cfab9951d
commit b7ec4da440
2 changed files with 4 additions and 3 deletions

View File

@@ -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(())

View File

@@ -130,6 +130,6 @@ fn main() {
} }
for handler in handles { for handler in handles {
handler.join().unwrap(); handler.join().unwrap_or(());
} }
} }