- `locals add` adds a local (unintroduced) certificate for encryption. - `locals remove` removes/deacivates a local certificate. - Overall cleanup
44 lines
989 B
Rust
44 lines
989 B
Rust
//! Husk milter
|
|
|
|
use std::process;
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
use clap::Parser;
|
|
use types::defaults;
|
|
|
|
pub mod cli;
|
|
use cli::cli_args::CliArgs;
|
|
pub mod commands;
|
|
pub mod config;
|
|
use config::{HuskConfig, HuskConfigContainer};
|
|
pub mod types;
|
|
pub mod mail;
|
|
pub mod daemon;
|
|
use daemon::Daemon;
|
|
pub mod common;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
let args = CliArgs::parse();
|
|
|
|
let config_file = match &args.config {
|
|
Some(c) => c.as_str(),
|
|
None => defaults::CONFIG_FILE_LOCATION
|
|
};
|
|
|
|
// XXX: Improve the way cli parameters are passed into the configuration.
|
|
let husk_config = match HuskConfig::load(config_file, args.home.clone()) {
|
|
Ok(config) => config,
|
|
Err(e) => {
|
|
eprintln!("{:?}", e);
|
|
process::exit(1);
|
|
}
|
|
};
|
|
|
|
husk_config.init_logging()?;
|
|
|
|
let config_container: HuskConfigContainer = Arc::new(Mutex::new(husk_config));
|
|
|
|
commands::dispatch(args, config_container).await
|
|
}
|