about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 72bc5e00e897..434bd40f3c67 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -83,6 +83,12 @@ fn main() {
 
     let oidc_addr: Addr<Syn, oidc::OidcExecutor> = oidc.start();
 
+    info!("Compiling templates ...");
+    let template_path = concat!(env!("CARGO_MANIFEST_DIR"), "/templates/**/*");
+    let tera = compile_templates!(template_path);
+    let renderer = render::Renderer(tera);
+    let renderer_addr: Addr<Syn, render::Renderer> = renderer.start();
+
     info!("Initialising HTTP server ...");
     let bind_host = config_default("CONVERSE_BIND_HOST", "127.0.0.1:4567");
     let key = {
@@ -95,12 +101,10 @@ fn main() {
     };
 
     server::new(move || {
-        let template_path = concat!(env!("CARGO_MANIFEST_DIR"), "/templates/**/*");
-        let tera = compile_templates!(template_path);
         let state = AppState {
             db: db_addr.clone(),
             oidc: oidc_addr.clone(),
-            tera,
+            renderer: renderer_addr.clone(),
         };
 
         let sessions = SessionStorage::new(