fix: sqlite ?mode=rwc, remove redundant libsqlite3-sys dep

This commit is contained in:
akn
2026-06-09 14:39:48 +09:00
parent e59f268460
commit 14c753bf14
2 changed files with 13 additions and 1 deletions
Generated
+1
View File
@@ -941,6 +941,7 @@ dependencies = [
"axum",
"chrono",
"futures",
"libsqlite3-sys",
"rumqttc",
"rust-embed",
"serde",
+12 -1
View File
@@ -192,9 +192,20 @@ async fn main() {
let db_path = std::env::var("NEWSBOARD_DB")
.unwrap_or_else(|_| "/var/lib/newsboard/news.db".into());
let db_path = std::env::var("NEWSBOARD_DB")
.unwrap_or_else(|_| "/var/lib/newsboard/news.db".into());
let url = if db_path == ":memory:" || db_path == "" {
"sqlite::memory:".to_string()
} else {
format!("sqlite:{}?mode=rwc", db_path)
};
tracing::info!(url = %url, "connecting to database");
let pool = SqlitePoolOptions::new()
.max_connections(5)
.connect(&format!("sqlite:{db_path}"))
.connect(&url)
.await
.expect("Failed to connect to SQLite");