wooly-vault/src/main.rs

31 lines
714 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};
2024-09-08 03:02:06 +02:00
use wooly_vault::start_all;
use wooly_vault::{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
start_all(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
}