summaryrefslogtreecommitdiff
path: root/src/env.rs
diff options
context:
space:
mode:
authorozpv <39195175+ozpv@users.noreply.github.com>2026-05-26 01:06:55 -0500
committerozpv <39195175+ozpv@users.noreply.github.com>2026-05-26 01:06:55 -0500
commit16f8cf5ced3ddcbfb142665e3f372e0fc8be73c5 (patch)
treeb4761495520d84ce4a7043ec528e290a2d1b0506 /src/env.rs
parent9590b3e84a9502accf801110b9695aab72423fb2 (diff)
add site
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/env.rs b/src/env.rs
new file mode 100644
index 0000000..0a4d46c
--- /dev/null
+++ b/src/env.rs
@@ -0,0 +1,20 @@
+use std::{env, path::PathBuf};
+
+pub struct Env {
+ pub site_addr: String,
+ pub dist_dir: PathBuf,
+}
+
+impl Env {
+ pub fn get_or_default() -> Self {
+ let site_addr = env::var("SITE_ADDR").unwrap_or_else(|_| "127.0.0.1:3000".to_string());
+ let dist_dir = env::var("DIST_DIR")
+ .unwrap_or_else(|_| format!("{}/public", env!("CARGO_MANIFEST_DIR")))
+ .into();
+
+ Self {
+ site_addr,
+ dist_dir,
+ }
+ }
+}