mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
refactor(config): Add new type for kms encrypted values (#1823)
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
//!
|
||||
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use masking::{ExposeInterface, Secret, Strategy};
|
||||
use masking::{ExposeInterface, PeekInterface, Secret, Strategy};
|
||||
use quick_xml::de;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -428,6 +428,30 @@ impl ConfigExt for String {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, U> ConfigExt for Secret<T, U>
|
||||
where
|
||||
T: ConfigExt + Default + PartialEq<T>,
|
||||
U: Strategy<T>,
|
||||
{
|
||||
fn is_default(&self) -> bool
|
||||
where
|
||||
T: Default + PartialEq<T>,
|
||||
{
|
||||
*self.peek() == T::default()
|
||||
}
|
||||
|
||||
fn is_empty_after_trim(&self) -> bool {
|
||||
self.peek().is_empty_after_trim()
|
||||
}
|
||||
|
||||
fn is_default_or_empty(&self) -> bool
|
||||
where
|
||||
T: Default + PartialEq<T>,
|
||||
{
|
||||
self.peek().is_default() || self.peek().is_empty_after_trim()
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension trait for deserializing XML strings using `quick-xml` crate
|
||||
pub trait XmlExt {
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user