Add Tera templates support

This commit is contained in:
Samuel Lorch 2024-01-14 23:13:11 +01:00
parent 5d952b736b
commit ecd71fc6a7
4 changed files with 613 additions and 17 deletions

View file

@ -16,10 +16,15 @@ use tracing::info;
use tracing_subscriber;
use web::auth::SessionState;
#[macro_use]
extern crate lazy_static;
mod api;
mod apply;
mod config_manager;
mod definitions;
mod state;
mod templates;
mod web;
#[tokio::main]

14
src/templates/mod.rs Normal file
View file

@ -0,0 +1,14 @@
use tera::Tera;
lazy_static! {
pub static ref TEMPLATES: Tera = {
let tera = match Tera::new("src/templates/**/*.net*") {
Ok(t) => t,
Err(e) => {
println!("Parsing error(s): {}", e);
::std::process::exit(1);
}
};
tera
};
}