2024-09-06 17:59:04 +02:00
|
|
|
use anyhow::Result;
|
|
|
|
use clap::Parser;
|
|
|
|
use libpt::log::{debug, info};
|
|
|
|
|
2024-09-08 02:59:58 +02:00
|
|
|
use wooly_vault::{config::Config, vault::Vault};
|
|
|
|
use wooly_vault::{select_and_start_single, start_all};
|
2024-09-05 17:18:08 +02:00
|
|
|
|
|
|
|
#[tokio::main(flavor = "current_thread")]
|
2024-09-06 17:59:04 +02:00
|
|
|
async fn main() -> Result<()> {
|
|
|
|
let conf = Config::parse();
|
|
|
|
|
2024-09-05 17:18:08 +02:00
|
|
|
let _logger = libpt::log::Logger::builder()
|
2024-09-06 17:59:04 +02:00
|
|
|
.set_level(conf.verbosity.level())
|
2024-09-05 17:18:08 +02:00
|
|
|
.display_time(false)
|
2024-09-08 01:37:05 +02:00
|
|
|
.log_to_file(true)
|
|
|
|
.log_dir("./log".into())
|
2024-09-05 17:18:08 +02:00
|
|
|
.build()?;
|
2024-09-08 01:37:05 +02:00
|
|
|
|
2024-09-06 17:59:04 +02:00
|
|
|
debug!("logger active");
|
|
|
|
info!("Configuration: {conf:?}");
|
2024-09-05 17:18:08 +02:00
|
|
|
|
2024-09-06 23:09:10 +02:00
|
|
|
let secret = Config::secret()?;
|
2024-09-06 17:59:04 +02:00
|
|
|
let v = Vault::new(&secret);
|
2024-09-05 17:18:08 +02:00
|
|
|
|
2024-09-08 02:59:58 +02:00
|
|
|
start_all(conf, v).await?;
|
2024-09-05 17:18:08 +02:00
|
|
|
|
2024-09-08 02:28:49 +02:00
|
|
|
loop {
|
|
|
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await
|
|
|
|
}
|
2024-09-06 17:59:04 +02:00
|
|
|
}
|