From 20ba84d1fac834c7402af1187204b7620a39b645 Mon Sep 17 00:00:00 2001
From: Ricky <Ricky@Hosfelt.io>
Date: Thu, 25 Oct 2018 17:50:54 +0100
Subject: [PATCH] Added in environment variable and the result is a file check
 in config.rs

---
 src/config.rs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/config.rs b/src/config.rs
index 0c9b33e2..62073978 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -9,7 +9,18 @@ use dirs::PROJECT_DIRS;
 use util::transpose;
 
 pub fn config_file() -> PathBuf {
-    PROJECT_DIRS.config_dir().join("config")
+    match env::var("BAT_CONFIG_PATH") {
+        Ok(env_path) => {
+            let env_path_buf = PathBuf::from(env_path);
+            if env_path_buf.is_file() {
+                return env_path_buf;
+            }
+            else {
+               return PROJECT_DIRS.config_dir().join("config"); 
+            }
+        }
+        Err(_) => PROJECT_DIRS.config_dir().join("config"),
+    }
 }
 
 pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {