wooly-vault/src/main.rs

30 lines
738 B
Rust
Raw Normal View History

2024-09-06 17:59:04 +02:00
use anyhow::Result;
use clap::Parser;
use libpt::log::{debug, info};
use wooly_vault::{challenge::select_and_start, config::Config, vault::Vault};
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)
.log_to_file(true)
.log_dir("./log".into())
2024-09-05 17:18:08 +02:00
.build()?;
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-06 17:59:04 +02:00
select_and_start(conf.challenge, conf, v).await?;
2024-09-05 17:18:08 +02:00
loop {
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await
}
2024-09-06 17:59:04 +02:00
}