Load environment variables optionally from .env

This is most helpful for local testing 😸
This commit is contained in:
R Tyler Croy 2021-06-12 09:48:34 -07:00
parent fe76b31955
commit 2f5f68b35c
4 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/target
*.swp
.env

7
Cargo.lock generated
View File

@ -390,6 +390,7 @@ dependencies = [
"aws_lambda_events",
"clap 2.33.3",
"deltalake",
"dotenv",
"lambda_runtime",
"log",
"parquet",
@ -475,6 +476,12 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]]
name = "dtoa"
version = "0.4.8"

View File

@ -8,6 +8,7 @@ edition = "2018"
arrow = "4"
clap = "2"
deltalake = { git = "https://github.com/rtyler/delta-rs", branch = "mixing-in-deltalake_ext", features = ["s3"] }
dotenv = "0.15"
log = "0.4"
parquet = "4"
pretty_env_logger = "0.4"

View File

@ -12,6 +12,8 @@ fn preboot() {
#[cfg(debug_assertions)]
pretty_env_logger::init();
dotenv::dotenv().ok();
info!(
"Initializing delta-s3-loader v{}",
env!["CARGO_PKG_VERSION"]