segrete rest from tera

This commit is contained in:
philipp 2023-07-16 18:33:17 +02:00
parent 9fbcffa2ea
commit cf6db88b25
2 changed files with 9 additions and 5 deletions

View File

@ -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
}

View File

@ -110,9 +110,8 @@ pub struct Config {
rss_key: String,
}
pub fn start(db: SqlitePool) -> Rocket<Build> {
rocket::build()
.manage(db)
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
rocket
.mount("/", routes![index, join, remove])
.mount("/auth", auth::routes())
.mount("/cox", cox::routes())