From cf6db88b25df070427fffc3659a2185acb848d2c Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 16 Jul 2023 18:33:17 +0200 Subject: [PATCH] segrete rest from tera --- src/main.rs | 9 +++++++-- src/tera/mod.rs | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 93542de..ba95c4c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,10 +14,15 @@ async fn rocket() -> _ { let mut connection_options = SqliteConnectOptions::from_str("sqlite://db.sqlite").unwrap(); connection_options.log_statements(log::LevelFilter::Debug); - let pool = PoolOptions::new() + let db: SqlitePool = PoolOptions::new() .connect_with(connection_options) .await .unwrap(); - tera::start(pool) + let rocket = rocket::build().manage(db); + + #[cfg(feature = "rowing-tera")] + let rocket = tera::config(rocket); + + rocket } diff --git a/src/tera/mod.rs b/src/tera/mod.rs index 4df1f31..7a4e6bc 100644 --- a/src/tera/mod.rs +++ b/src/tera/mod.rs @@ -110,9 +110,8 @@ pub struct Config { rss_key: String, } -pub fn start(db: SqlitePool) -> Rocket { - rocket::build() - .manage(db) +pub fn config(rocket: Rocket) -> Rocket { + rocket .mount("/", routes![index, join, remove]) .mount("/auth", auth::routes()) .mount("/cox", cox::routes())