diff options
| author | Xe Iaso <me@christine.website> | 2022-07-10 20:29:07 +0000 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-07-10 20:29:07 +0000 |
| commit | 55bf7e4cb403566d7172ef69b8f2f7393ac8627d (patch) | |
| tree | 7b3682e19c97672245cbb97e6c1d1069e812fd8b /src/app/mod.rs | |
| parent | b32f5a25afb7b9901476164663c1b7099dcec7a8 (diff) | |
| download | xesite-55bf7e4cb403566d7172ef69b8f2f7393ac8627d.tar.xz xesite-55bf7e4cb403566d7172ef69b8f2f7393ac8627d.zip | |
basic notes support
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src/app/mod.rs')
| -rw-r--r-- | src/app/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs index 5b8e719..24eabc5 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,7 +1,9 @@ use crate::{post::Post, signalboost::Person}; +use bb8::Pool; +use bb8_rusqlite::RusqliteConnectionManager; use chrono::prelude::*; use color_eyre::eyre::Result; -use std::{fs, path::PathBuf, sync::Arc}; +use std::{env, fs, path::PathBuf, sync::Arc}; use tracing::{error, instrument}; pub mod config; @@ -58,6 +60,7 @@ pub struct State { pub sitemap: Vec<u8>, pub patrons: Option<patreon::Users>, pub mi: mi::Client, + pub pool: Pool<RusqliteConnectionManager>, } pub async fn init(cfg: PathBuf) -> Result<State> { @@ -73,6 +76,10 @@ pub async fn init(cfg: PathBuf) -> Result<State> { let gallery = crate::post::load(cfg.clone(), "gallery").await?; let talks = crate::post::load(cfg.clone(), "talks").await?; let mut everything: Vec<Post> = vec![]; + let mgr = RusqliteConnectionManager::new( + env::var("DATABASE_URL").unwrap_or("./var/waifud.db".to_string()), + ); + let pool = bb8::Pool::builder().build(mgr).await?; { let blog = blog.clone(); @@ -150,6 +157,7 @@ pub async fn init(cfg: PathBuf) -> Result<State> { jf: jfb.build(), sitemap: sm, patrons: patrons().await?, + pool, }) } |
