From f2a620499f13d43f39dd92b87dbfbb8bdc8c2228 Mon Sep 17 00:00:00 2001 From: serxoz Date: Fri, 20 Jan 2023 21:46:35 +0100 Subject: [PATCH] olvideime de agregar lib.rs --- src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/lib.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..1c047a8 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,18 @@ +use std::env; + +// le a variable de entorno TEMPLATES para configurar o path รณ directorio dos templates +pub fn env_templates_dir() -> String { + match env::var_os("TEMPLATES") { + Some(val) => val.into_string().unwrap(), + None => "templates/".to_string(), + } +} + +// le a variable de entorno PORT para configurar o porto de escoita +// por defecto o 3000 +pub fn env_listen_port() -> u16 { + match env::var_os("PORT") { + Some(val) => val.into_string().unwrap().parse::().unwrap(), + None => 3000, + } +}