2024-04-18 04:41:26 +00:00
|
|
|
use std::path::Path;
|
|
|
|
|
2024-04-13 02:17:34 +00:00
|
|
|
use config::Config;
|
2024-04-16 00:19:09 +00:00
|
|
|
use tracing::error;
|
2024-04-13 02:17:34 +00:00
|
|
|
|
|
|
|
pub mod config;
|
2023-12-20 06:18:09 +00:00
|
|
|
pub mod engines;
|
|
|
|
pub mod normalize;
|
|
|
|
pub mod parse;
|
|
|
|
pub mod web;
|
|
|
|
|
2023-12-22 00:43:29 +00:00
|
|
|
#[tokio::main(flavor = "current_thread")]
|
2023-12-20 06:18:09 +00:00
|
|
|
async fn main() {
|
2024-04-16 00:19:09 +00:00
|
|
|
tracing_subscriber::fmt::init();
|
|
|
|
|
2024-04-18 04:41:26 +00:00
|
|
|
let config_path = std::env::args().nth(1).unwrap_or("config.toml".into());
|
|
|
|
let config_path = Path::new(&config_path);
|
|
|
|
|
|
|
|
let config = match Config::read_or_create(config_path) {
|
2024-04-13 02:17:34 +00:00
|
|
|
Ok(config) => config,
|
|
|
|
Err(err) => {
|
2024-04-16 00:19:09 +00:00
|
|
|
error!("Couldn't parse config:\n{err}");
|
2024-04-13 02:17:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
web::run(config).await;
|
2023-12-20 06:18:09 +00:00
|
|
|
}
|