wip: early integration

This commit is contained in:
2023-11-25 15:46:49 +11:00
parent f40b8677ab
commit 11e2a14cc4
7 changed files with 211 additions and 34 deletions

View File

@@ -2,10 +2,28 @@ mod daemon;
mod config;
pub(crate) mod error;
use std::env;
use std::error as std_err;
pub async fn start() -> Result<(), Box<dyn std_err::Error>> {
let _config = config::Config::find(vec![String::from("/etc/wingmate")])?;
dbg!(_config);
daemon::start().await
let mut vec_search: Vec<String> = Vec::new();
match env::var("WINGMATE_CONFIG_PATH") {
Ok(paths) => {
for p in paths.split(':') {
vec_search.push(String::from(p));
}
},
Err(e) => {
if let env::VarError::NotUnicode(_) = e {
return Err(e.into());
} else {
vec_search.push(String::from("/etc/wingmate"));
}
}
}
let config = config::Config::find(vec_search)?;
dbg!(&config);
daemon::start(config).await
}