From 9e5c2192d4ac6a557cc52bcb3448ddc54d4f7507 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 26 Feb 2021 01:21:29 +0300 Subject: [PATCH] feat: add dotenv to load migra config --- migra-cli/Cargo.toml | 12 ++++++++---- migra-cli/src/main.rs | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/migra-cli/Cargo.toml b/migra-cli/Cargo.toml index 4392400..7fd671a 100644 --- a/migra-cli/Cargo.toml +++ b/migra-cli/Cargo.toml @@ -24,9 +24,13 @@ path = "tests/commands.rs" structopt = "0.3" serde = { version = "1.0", features = ["derive"] } toml = "0.5" -chrono = "0.4.19" -postgres = "0.19.0" +chrono = "0.4" +postgres = "0.19" +dotenv = { version = "0.15", optional = true } [dev-dependencies] -assert_cmd = "1.0.3" -predicates = "1.0.7" +assert_cmd = "1" +predicates = "1" + +[features] +default = [] diff --git a/migra-cli/src/main.rs b/migra-cli/src/main.rs index d8e4526..ce0ec59 100644 --- a/migra-cli/src/main.rs +++ b/migra-cli/src/main.rs @@ -13,6 +13,9 @@ use opts::{AppOpt, Command, StructOpt}; use std::io; fn main() -> StdResult<()> { + #[cfg(feature = "dotenv")] + dotenv::dotenv().ok(); + let opt = AppOpt::from_args(); match opt.command {