pub struct EncryptionConfig {
pub enabled: bool,
pub passphrase: Option<String>,
pub env_var: Option<String>,
}Expand description
Encryption configuration
Fields§
§enabled: boolWhether encryption is enabled
passphrase: Option<String>Passphrase for encryption/decryption (if enabled)
env_var: Option<String>Environment variable name to read passphrase from
Implementations§
Source§impl EncryptionConfig
impl EncryptionConfig
Sourcepub fn new(passphrase: String) -> Self
pub fn new(passphrase: String) -> Self
Create a new encryption config with the given passphrase
Sourcepub fn from_env(env_var: String) -> Self
pub fn from_env(env_var: String) -> Self
Create a new encryption config that reads passphrase from environment variable
Sourcepub fn get_passphrase(&self) -> Result<Option<String>>
pub fn get_passphrase(&self) -> Result<Option<String>>
Get the passphrase, either directly or from environment
Trait Implementations§
Source§impl Clone for EncryptionConfig
impl Clone for EncryptionConfig
Source§fn clone(&self) -> EncryptionConfig
fn clone(&self) -> EncryptionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EncryptionConfig
impl Debug for EncryptionConfig
Source§impl Default for EncryptionConfig
impl Default for EncryptionConfig
Source§fn default() -> EncryptionConfig
fn default() -> EncryptionConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EncryptionConfig
impl<'de> Deserialize<'de> for EncryptionConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for EncryptionConfig
impl Display for EncryptionConfig
Auto Trait Implementations§
impl Freeze for EncryptionConfig
impl RefUnwindSafe for EncryptionConfig
impl Send for EncryptionConfig
impl Sync for EncryptionConfig
impl Unpin for EncryptionConfig
impl UnsafeUnpin for EncryptionConfig
impl UnwindSafe for EncryptionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more