From c33bf143ef59884f984a52bcc8e407cc942024bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=98=D0=B0=D0=BD=20=D0=93=D0=B5=D0=BE?= =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=B5=D0=B2=D1=81=D0=BA=D0=B8?= Date: Fri, 1 Feb 2019 19:29:12 +0100 Subject: [PATCH] only use dotenv in debug builds, not in release builds dotenv will look for .env files in the current and all parent directories. this is potentionaly dangerous. --- src/config.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 2c230bd4..a80771e4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -125,7 +125,9 @@ impl Config { fn load() -> Self { use crate::util::{get_env, get_env_or}; - dotenv::dotenv().ok(); + #[cfg(debug_assertions)] { + dotenv::dotenv().ok(); + } let df = get_env_or("DATA_FOLDER", "data".to_string()); let key = get_env_or("RSA_KEY_FILENAME", format!("{}/{}", &df, "rsa_key"));