Going back to relative urls, this was a systemd problem
This commit is contained in:
parent
821d47153e
commit
136b42918f
13
src/lib.rs
13
src/lib.rs
|
@ -17,11 +17,6 @@ use sqlx::{
|
||||||
SqlitePool,
|
SqlitePool,
|
||||||
};
|
};
|
||||||
|
|
||||||
// #[cfg(not(debug_assertions))]
|
|
||||||
// const CACHE_URL: &str = "sqlite://:memory:";
|
|
||||||
// #[cfg(debug_assertions)]
|
|
||||||
const CACHE_URL: &str = "cache.db";
|
|
||||||
|
|
||||||
/// A Sqlite database for all blog data.
|
/// A Sqlite database for all blog data.
|
||||||
///
|
///
|
||||||
/// It uses a file-backed db for posts, drafts, users, and assets, and an in-memory db for cached
|
/// It uses a file-backed db for posts, drafts, users, and assets, and an in-memory db for cached
|
||||||
|
@ -38,8 +33,8 @@ impl BlogDb {
|
||||||
where
|
where
|
||||||
S: AsRef<str>,
|
S: AsRef<str>,
|
||||||
{
|
{
|
||||||
let main_db_name = dotenvy::var("DB_MAIN_PATH")?;
|
let main_db_name = dotenvy::var("DB_MAIN_PATH").unwrap_or("main.db".to_string());
|
||||||
let cache_name = dotenvy::var("DB_CACHE_PATH")?;
|
let cache_name = dotenvy::var("DB_CACHE_PATH").unwrap_or("cache.db".to_string());
|
||||||
if File::open(&main_db_name).is_err() {
|
if File::open(&main_db_name).is_err() {
|
||||||
File::create_new(&main_db_name)?;
|
File::create_new(&main_db_name)?;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +43,7 @@ impl BlogDb {
|
||||||
}
|
}
|
||||||
let db = SqlitePoolOptions::new()
|
let db = SqlitePoolOptions::new()
|
||||||
.connect_with(
|
.connect_with(
|
||||||
SqliteConnectOptions::from_str(&["sqlite:///", &main_db_name].concat())?
|
SqliteConnectOptions::from_str(&["sqlite://", &main_db_name].concat())?
|
||||||
.journal_mode(SqliteJournalMode::Wal),
|
.journal_mode(SqliteJournalMode::Wal),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -58,7 +53,7 @@ impl BlogDb {
|
||||||
// #[cfg(not(debug_assertions))]
|
// #[cfg(not(debug_assertions))]
|
||||||
// SqliteConnectOptions::from_str(MEMORY_URL)?.journal_mode(SqliteJournalMode::Memory),
|
// SqliteConnectOptions::from_str(MEMORY_URL)?.journal_mode(SqliteJournalMode::Memory),
|
||||||
// #[cfg(debug_assertions)]
|
// #[cfg(debug_assertions)]
|
||||||
SqliteConnectOptions::from_str(&["sqlite:///", &cache_name].concat())?
|
SqliteConnectOptions::from_str(&["sqlite://", &cache_name].concat())?
|
||||||
.journal_mode(SqliteJournalMode::Wal),
|
.journal_mode(SqliteJournalMode::Wal),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in New Issue