2023-09-29 12:15:07 +02:00
|
|
|
#![forbid(unsafe_code)]
|
|
|
|
#![warn(clippy::suspicious)]
|
|
|
|
#![warn(clippy::correctness)]
|
|
|
|
|
2023-10-01 06:17:58 +02:00
|
|
|
mod files;
|
2023-09-29 12:15:07 +02:00
|
|
|
mod env;
|
|
|
|
mod web;
|
2023-10-01 02:14:35 +02:00
|
|
|
mod db;
|
2023-10-20 17:12:16 +02:00
|
|
|
mod config;
|
2023-09-29 12:15:07 +02:00
|
|
|
|
2023-10-15 09:16:08 +02:00
|
|
|
pub mod security;
|
|
|
|
|
2023-09-29 12:15:07 +02:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
|
|
|
dotenvy::dotenv().unwrap();
|
2023-10-15 09:16:08 +02:00
|
|
|
let envy = env::loadenv().map_err(|err| format!("Could not load env: {err}")).unwrap();
|
2023-10-20 17:12:16 +02:00
|
|
|
let conf = config::types::Config::load(envy.clone()).unwrap();
|
2023-09-29 12:15:07 +02:00
|
|
|
|
|
|
|
// set up logging
|
|
|
|
if envy.logging {
|
|
|
|
#[cfg(debug_assertions)] {
|
|
|
|
femme::with_level(femme::LevelFilter::Debug)
|
|
|
|
}
|
|
|
|
#[cfg(not(debug_assertions))] {
|
|
|
|
femme::with_level(femme::LevelFilter::Info)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
femme::with_level(femme::LevelFilter::Off);
|
|
|
|
}
|
|
|
|
|
2023-10-20 17:49:36 +02:00
|
|
|
web::serve(envy, conf).await;
|
2023-09-29 12:15:07 +02:00
|
|
|
}
|