aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index b2af6de..0a7bd56 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,11 +1,11 @@
use std::env;
use std::net::SocketAddr;
+use anyhow::Result;
use hyper::server::conn::http1;
use hyper::service::service_fn;
use hyper_util::rt::TokioIo;
use tokio::net::TcpListener;
-use tokio_rusqlite::Connection;
mod db;
mod jobs;
@@ -15,7 +15,7 @@ mod templates;
mod util;
#[tokio::main]
-async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
+async fn main() -> Result<()> {
env_logger::init();
let host = get_env("HOST");
@@ -24,9 +24,7 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
let authorized_key = get_env("KEY");
let files_dir = get_env("FILES_DIR");
- let db_conn = Connection::open(db_path)
- .await
- .expect("Error while openning DB conection");
+ let db_conn = db::init(&db_path).await?;
tokio::spawn(jobs::start(db_conn.clone(), files_dir.clone()));