aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-server/src/app.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/rocie-server/src/app.rs11
1 files changed, 3 insertions, 8 deletions
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<Self, app_create::Error> {
- let db_path: PathBuf = PathBuf::from(env::var("ROCIE_DB_PATH")?);
-
+ pub(crate) async fn new(db_path: PathBuf) -> Result<Self, app_create::Error> {
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,