]> Humopery - waterslager.git/commitdiff
Allow .env to be missing
authorfozzie <fozzie@humopery.space>
Fri, 18 Jul 2025 23:54:16 +0000 (18:54 -0500)
committerfozzie <fozzie@humopery.space>
Fri, 18 Jul 2025 23:54:16 +0000 (18:54 -0500)
.env
src/main.rs

diff --git a/.env b/.env
index 123757111401484b1c95c0d2ba06d477e342fdaf..3015b73bddd00466db756d99d5b57e659e64f0ec 100644 (file)
--- a/.env
+++ b/.env
@@ -1,2 +1,2 @@
-BIND_HOST=127.0.0.1
-BIND_PORT=3000
+BIND_HOST=127.0.0.1
+BIND_PORT=3000
index 6f949b6debc4ffcdd4ef5cca9f78b3331b2809ce..ded6233b46be6138f60368218c5418add7cf0d9c 100644 (file)
@@ -38,12 +38,13 @@ async fn load_certs_from_fs() -> Result<CertMap,Box<dyn std::error::Error>> {
 #[tokio::main]
 async fn main() -> Result<(),Box<dyn std::error::Error>> {
     
-    // Set default config values, then override with .env
+    // Set config from .env, ignoring any error (file may not be there)
+    let _ = dotenvy::dotenv();
+    // ... then override with defaults
     unsafe {
        env::set_var("BIND_HOST","127.0.0.1");
        env::set_var("BIND_PORT","3000");
     }
-    dotenvy::dotenv_override()?;
 
     let certs = load_certs_from_fs().await.unwrap();