From 75dbc0bd7652a4a3b95894ec2a04d4da379bcc15 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Wed, 19 Jan 2022 13:39:41 -0700 Subject: [PATCH] return null for tor-key pointer if doesn't exist --- appmgr/src/config/spec.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/appmgr/src/config/spec.rs b/appmgr/src/config/spec.rs index d46203fc0..22f763463 100644 --- a/appmgr/src/config/spec.rs +++ b/appmgr/src/config/spec.rs @@ -1849,13 +1849,17 @@ impl TorKeyPointer { *self.package_id, *self.interface ) - .fetch_one(secrets) + .fetch_optional(secrets) .await .map_err(|e| ConfigurationError::SystemError(e.into()))?; - Ok(Value::String(base32::encode( - base32::Alphabet::RFC4648 { padding: false }, - &x.key, - ))) + if let Some(x) = x { + Ok(Value::String(base32::encode( + base32::Alphabet::RFC4648 { padding: false }, + &x.key, + ))) + } else { + Ok(Value::Null) + } } } impl fmt::Display for TorKeyPointer {