aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/tutorial02/main.rs1
-rw-r--r--src/db/backend.rs5
-rw-r--r--src/db/mod.rs1
-rw-r--r--src/settings.rs8
4 files changed, 12 insertions, 3 deletions
diff --git a/examples/tutorial02/main.rs b/examples/tutorial02/main.rs
index c662001..eeb7524 100644
--- a/examples/tutorial02/main.rs
+++ b/examples/tutorial02/main.rs
@@ -17,7 +17,6 @@ fn settings() -> Settings {
&polls::APP,
&admin::APP,
],
- database_url: "example_data.sqlite3",
..Settings::default()
}
}
diff --git a/src/db/backend.rs b/src/db/backend.rs
new file mode 100644
index 0000000..5ae4de2
--- /dev/null
+++ b/src/db/backend.rs
@@ -0,0 +1,5 @@
+pub enum DbBackend {
+ Sqlite {
+ db_file: &'static str,
+ }
+}
diff --git a/src/db/mod.rs b/src/db/mod.rs
index c446ac8..b6528f5 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -1 +1,2 @@
+pub mod backend;
pub mod models;
diff --git a/src/settings.rs b/src/settings.rs
index 9d34c0d..37a3395 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -1,13 +1,17 @@
+use crate::db::backend::DbBackend;
+
pub struct Settings {
pub installed_apps: &'static [&'static crate::apps::AppConfig],
- pub database_url: &'static str,
+ pub database: DbBackend,
}
impl Default for Settings {
fn default() -> Self {
Self {
installed_apps: &[],
- database_url: "",
+ database: DbBackend::Sqlite {
+ db_file: "db.sqlite3",
+ },
}
}
}