diff --git a/Cargo.toml b/Cargo.toml index 708477d..4d24841 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,11 +3,13 @@ name = "rot" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = ["rowing-tera"] +rowing-tera = ["rocket_dyn_templates", "tera"] [dependencies] rocket = { version = "0.5.0-rc.3", features = ["secrets"]} -rocket_dyn_templates = {version = "0.1.0-rc.3", features = [ "tera" ] } +rocket_dyn_templates = {version = "0.1.0-rc.3", features = [ "tera" ], optional = true } log = "0.4" env_logger = "0.10" sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls", "macros", "chrono", "time"] } @@ -15,5 +17,5 @@ argon2 = "0.5" serde = { version = "1.0", features = [ "derive" ]} serde_json = "1.0" chrono = { version = "0.4", features = ["serde"]} -tera = { version = "1.18", features = ["date-locale"]} +tera = { version = "1.18", features = ["date-locale"], optional = true} ics = "0.5" diff --git a/rot_app/src/+layout.js/.ts b/rot_app/src/+layout.js/.ts new file mode 100644 index 0000000..f19d054 --- /dev/null +++ b/rot_app/src/+layout.js/.ts @@ -0,0 +1,2 @@ +export const prerender = true; + diff --git a/src/lib.rs b/src/lib.rs index dd4f853..78160a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ pub mod model; -pub mod rest; + +#[cfg(feature = "rowing-tera")] +pub mod tera; #[cfg(test)] #[macro_export] diff --git a/src/main.rs b/src/main.rs index 2067b44..93542de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,17 @@ use std::str::FromStr; -use rot::rest; +#[cfg(feature = "rowing-tera")] +use rot::tera; use sqlx::{pool::PoolOptions, sqlite::SqliteConnectOptions, ConnectOptions}; #[macro_use] extern crate rocket; +#[cfg(feature = "rowing-tera")] #[launch] async fn rocket() -> _ { env_logger::init(); - //let pool = SqlitePool::connect(":memory:").await.unwrap(); let mut connection_options = SqliteConnectOptions::from_str("sqlite://db.sqlite").unwrap(); connection_options.log_statements(log::LevelFilter::Debug); let pool = PoolOptions::new() @@ -18,5 +19,5 @@ async fn rocket() -> _ { .await .unwrap(); - rest::start(pool) + tera::start(pool) } diff --git a/src/rest/admin/mod.rs b/src/tera/admin/mod.rs similarity index 92% rename from src/rest/admin/mod.rs rename to src/tera/admin/mod.rs index 521c54d..b0cc07d 100644 --- a/src/rest/admin/mod.rs +++ b/src/tera/admin/mod.rs @@ -1,7 +1,7 @@ use rocket::{get, routes, Route, State}; use sqlx::SqlitePool; -use crate::{model::log::Log, rest::Config}; +use crate::{model::log::Log, tera::Config}; pub mod planned_event; pub mod user; diff --git a/src/rest/admin/planned_event.rs b/src/tera/admin/planned_event.rs similarity index 100% rename from src/rest/admin/planned_event.rs rename to src/tera/admin/planned_event.rs diff --git a/src/rest/admin/user.rs b/src/tera/admin/user.rs similarity index 100% rename from src/rest/admin/user.rs rename to src/tera/admin/user.rs diff --git a/src/rest/auth.rs b/src/tera/auth.rs similarity index 100% rename from src/rest/auth.rs rename to src/tera/auth.rs diff --git a/src/rest/cox.rs b/src/tera/cox.rs similarity index 100% rename from src/rest/cox.rs rename to src/tera/cox.rs diff --git a/src/rest/misc.rs b/src/tera/misc.rs similarity index 100% rename from src/rest/misc.rs rename to src/tera/misc.rs diff --git a/src/rest/mod.rs b/src/tera/mod.rs similarity index 100% rename from src/rest/mod.rs rename to src/tera/mod.rs