fix: pass full env file path

This commit is contained in:
əlemi 2024-10-30 02:37:45 +01:00
parent cb225ae7de
commit 324b7ce705
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -24,8 +24,8 @@ struct PostWomanArgs {
collection: std::path::PathBuf, collection: std::path::PathBuf,
/// environment (.env) to load /// environment (.env) to load
#[arg(short, long, default_value = "")] #[arg(short, long, default_value = ".env")]
env: String, env: std::path::PathBuf,
/// action to run /// action to run
#[clap(subcommand)] #[clap(subcommand)]
@ -92,8 +92,8 @@ fn main() {
PostWomanActions::Run { query, parallel, debug, dry_run } => { PostWomanActions::Run { query, parallel, debug, dry_run } => {
eprintln!("~@ {APP_USER_AGENT}"); eprintln!("~@ {APP_USER_AGENT}");
if let Err(e) = dotenv::from_filename(format!("{}.env", args.env)) { if dotenv::from_path(&args.env).is_ok() {
eprintln!(" ! error loading env file: {e}"); eprintln!(" # loaded env file {:?}", args.env);
} }
// note that if you remove this test, there's another .expect() below you need to manage too! // note that if you remove this test, there's another .expect() below you need to manage too!