From 5b35b73b5668be6b25c68a8fced9cd9f46204f89 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Fri, 19 Apr 2024 14:31:24 -0700 Subject: [PATCH] reword error message about `CONDUIT_CONFIG` The new message more accurately reflects the purpose and behaviors of the environment variable. --- src/main.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index fda3a241..3d66e5ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,15 +58,16 @@ async fn try_main() -> Result<(), Box> { clap::parse(); // Initialize config - let raw_config = - Figment::new() - .merge( - Toml::file(Env::var("CONDUIT_CONFIG").ok_or( - "The CONDUIT_CONFIG env var needs to be set. Example: /etc/conduit.toml", - )?) - .nested(), - ) - .merge(Env::prefixed("CONDUIT_").global()); + let raw_config = Figment::new() + .merge( + Toml::file(Env::var("CONDUIT_CONFIG").ok_or( + "the `CONDUIT_CONFIG` environment variable must either be set to a \ + configuration file path or set to the empty string to force configuration \ + through environment variables", + )?) + .nested(), + ) + .merge(Env::prefixed("CONDUIT_").global()); let config = raw_config.extract::()?;