aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Pasquet <dev@etenil.net>2022-02-26 09:31:28 +0000
committerGuillaume Pasquet <dev@etenil.net>2022-02-26 09:31:28 +0000
commit3662c87b1c84d5a023d8e61f3bc3073dbf9c4324 (patch)
tree40ae7e995f2544e94b2bb7820de87e5d750592cf
parentafb40e676d4aa097dc5f17d3fd021c06eaf6aa72 (diff)
Fix #11: add support for .env files
-rw-r--r--Cargo.lock9
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs4
3 files changed, 12 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 74a3555..3cf0aa4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -36,11 +36,12 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "barb"
-version = "0.1.5"
+version = "0.2.0"
dependencies = [
"clap 3.0.14",
"colored",
"colored_json",
+ "dotenv",
"jq-rs",
"jsonformat",
"serde",
@@ -163,6 +164,12 @@ dependencies = [
]
[[package]]
+name = "dotenv"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
+
+[[package]]
name = "flate2"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index a761589..e10d0d6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,3 +20,4 @@ jsonformat = "1.2.0"
jq-rs = "0.4.1"
colored = "2.0.0"
colored_json = "2.1.0"
+dotenv = "0.15.0" \ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index b7ce5ba..bbe2bf0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -15,6 +15,8 @@ use std::env;
use std::fs;
use std::str::FromStr;
+use dotenv::dotenv;
+
#[derive(Parser, Debug)]
#[clap(version)]
struct Args {
@@ -95,7 +97,7 @@ fn run_file(args: &Args, executor: &mut Executor, file_name: &String) -> Result<
fn main() {
let args = Args::parse();
-
+ dotenv().ok();
let mut executor = Executor::new(Context::new(env::vars()));
for file in args.files_iter() {