From 2dc74d621399be454abbbff892fb46204ddc6e7b Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 23 Sep 2025 08:33:06 +0200 Subject: feat(treewide): Add tests and barcode buying/consuming --- crates/rocie-server/src/app.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'crates/rocie-server/src/app.rs') diff --git a/crates/rocie-server/src/app.rs b/crates/rocie-server/src/app.rs index ab8f764..bb27470 100644 --- a/crates/rocie-server/src/app.rs +++ b/crates/rocie-server/src/app.rs @@ -1,4 +1,4 @@ -use std::{env, path::PathBuf}; +use std::path::PathBuf; use sqlx::{SqlitePool, sqlite::SqliteConnectOptions}; @@ -10,9 +10,7 @@ pub(crate) struct App { } impl App { - pub(crate) async fn new() -> Result { - let db_path: PathBuf = PathBuf::from(env::var("ROCIE_DB_PATH")?); - + pub(crate) async fn new(db_path: PathBuf) -> Result { let db = { let options = SqliteConnectOptions::new() .filename(&db_path) @@ -36,15 +34,12 @@ impl App { } pub(crate) mod app_create { - use std::{env, path::PathBuf}; + use std::path::PathBuf; use crate::storage::migrate::migrate_db; #[derive(thiserror::Error, Debug)] pub(crate) enum Error { - #[error("The `ROCIE_DB_PATH` variable is not accessible: {0}")] - MissingDbVariable(#[from] env::VarError), - #[error("Failed to connect to the sqlite database at `{db_path}`, because: {inner}")] DbConnectionFailed { inner: sqlx::Error, -- cgit 1.4.1