use std::sync::{Arc, RwLock};
use tera::Tera;
#[derive(Debug)]
pub struct TemplateStore {
pub templates: Arc<RwLock<Tera>>,
}
pub fn load() -> TemplateStore {
let templates_glob = std::env::var("templdates_folder").expect("TEMPLATES_GLOB not set!");
let templates = Arc::new(RwLock::new(
Tera::new(&templates_glob).expect("Unable to compile templates!"),
));
TemplateStore {
templates: templates,
}
}