1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::sync::{Arc, Mutex};

use crate::templates;

/// Loads all the HTML content into a Jinja Environment
pub fn environment() -> Arc<Mutex<minijinja::Environment<'static>>> {
    let mut env = minijinja::Environment::new();
    env.add_template_owned("index", templates::index::get_content()).unwrap();
    env.add_template_owned("landing", templates::landing::get_content()).unwrap();
    env.add_template_owned("listing", templates::listing::get_content()).unwrap();
    env.add_template_owned("logout", templates::logout::get_content()).unwrap();
    env.add_template_owned("session", templates::session::get_content()).unwrap();
    env.add_template_owned("unauthorized", templates::unauthorized::get_content()).unwrap();
    let mutex = Mutex::new(env.to_owned());
    Arc::new(mutex)
}