sqlx
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
JMARyA 2024-12-08 17:59:30 +01:00
parent 3e35dd669a
commit d6d44b457c
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
7 changed files with 1079 additions and 148 deletions

View file

@ -1,10 +1,13 @@
#![feature(async_closure)]
use hoard::config::GlobalConfig;
use hoard::{ensure_dir_exists, Module};
// todo : migrate to async code?
// todo : better log options
fn main() {
#[tokio::main]
async fn main() {
#[cfg(debug_assertions)]
{
std::env::set_var("RUST_LOG", "trace");
@ -21,11 +24,12 @@ fn main() {
log::info!("Starting hoard");
let db = hoard::db::DatabaseBackend::new("data/download.db");
let config: GlobalConfig =
toml::from_str(&std::fs::read_to_string("config.toml").unwrap()).unwrap();
ensure_dir_exists(&config.hoard.data_dir);
let db = hoard::db::DatabaseBackend::new(&config.hoard.database).await;
let mut modules: Vec<Box<dyn Module>> = vec![];
if let Some(yt_config) = config.youtube {
@ -56,10 +60,6 @@ fn main() {
)));
}
let _db_thread = std::thread::spawn(move || {
db.run();
});
let threads: Vec<_> = modules
.into_iter()
.map(|x| {