From 98d71f031121c26f4f08721ca860c003e55915b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Tue, 16 Aug 2022 23:51:07 +0100 Subject: [PATCH] Add dev mode --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index 1820455..1a4fcc4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,10 @@ struct Config { #[clap(long, default_value = "127.0.0.1:8000", value_parser)] /// The address on which to listen address: SocketAddr, + #[clap(long, action)] + /// Whether to start the server in dev mode; this enables some + /// nice handlebars features that are not intended for production + dev_mode: bool, } struct SharedData<'a> { @@ -88,6 +92,7 @@ async fn main() -> Result<(), std::io::Error> { handlebars .register_templates_directory(".html", config.template_directory.clone()) .expect("templates should compile correctly"); + handlebars.set_dev_mode(config.dev_mode); let shared_data = web::Data::new(SharedData { handlebars,