diff --git a/payjoin-cli/src/app/config.rs b/payjoin-cli/src/app/config.rs index faf22536..0755e8aa 100644 --- a/payjoin-cli/src/app/config.rs +++ b/payjoin-cli/src/app/config.rs @@ -92,6 +92,16 @@ impl AppConfig { )? }; + #[cfg(feature = "v2")] + let ohttp_keys = matches + .get_one::("ohttp_keys") + .map(|s| std::fs::read(s)) + .transpose() + .map_err(|e| { + log::error!("Failed to read ohttp_keys file: {}", e); + ConfigError::Message(format!("Failed to read ohttp_keys file: {}", e)) + })?; + #[cfg(feature = "v2")] let builder = { builder @@ -99,20 +109,7 @@ impl AppConfig { "pj_directory", matches.get_one::("pj_directory").map(|s| s.as_str()), )? - .set_override_option( - "ohttp_keys", - matches.get_one::("ohttp_keys").and_then(|s| { - std::fs::read(s) - .map_err(|e| { - log::error!("Failed to read ohttp_keys file: {}", e); - ConfigError::Message(format!( - "Failed to read ohttp_keys file: {}", - e - )) - }) - .ok() - }), - )? + .set_override_option("ohttp_keys", ohttp_keys)? }; let max_fee_rate = matches