From 324b7ce70593354c9015f0e56819809e1f5e768a Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 30 Oct 2024 02:37:45 +0100 Subject: [PATCH] fix: pass full env file path --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index d2a0eb9..dcbc886 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,8 +24,8 @@ struct PostWomanArgs { collection: std::path::PathBuf, /// environment (.env) to load - #[arg(short, long, default_value = "")] - env: String, + #[arg(short, long, default_value = ".env")] + env: std::path::PathBuf, /// action to run #[clap(subcommand)] @@ -92,8 +92,8 @@ fn main() { PostWomanActions::Run { query, parallel, debug, dry_run } => { eprintln!("~@ {APP_USER_AGENT}"); - if let Err(e) = dotenv::from_filename(format!("{}.env", args.env)) { - eprintln!(" ! error loading env file: {e}"); + if dotenv::from_path(&args.env).is_ok() { + eprintln!(" # loaded env file {:?}", args.env); } // note that if you remove this test, there's another .expect() below you need to manage too!