pub struct EnvironmentProvider { /* private fields */ }Expand description
Secret provider that reads from environment variables.
Secrets are looked up using the pattern: {PREFIX}{CONTEXT}_{KEY}
where context and key are converted to uppercase with - replaced by _.
§Example
With prefix SECRET_ and context my-context, key api-key:
- Environment variable:
SECRET_MY_CONTEXT_API_KEY
Implementations§
Trait Implementations§
Source§impl SecretProvider for EnvironmentProvider
impl SecretProvider for EnvironmentProvider
Source§fn get_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SecretValue>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SecretValue>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get a secret value. Read more
Source§fn set_secret<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
_value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn set_secret<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
_value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Set a secret value.
Source§fn delete_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete a secret.
Source§fn list_keys<'life0, 'life1, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_keys<'life0, 'life1, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all secret keys for a context.
Source§fn is_read_only(&self) -> bool
fn is_read_only(&self) -> bool
Check if this provider is read-only.
Source§fn has_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn has_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if a secret exists.
Auto Trait Implementations§
impl Freeze for EnvironmentProvider
impl RefUnwindSafe for EnvironmentProvider
impl Send for EnvironmentProvider
impl Sync for EnvironmentProvider
impl Unpin for EnvironmentProvider
impl UnwindSafe for EnvironmentProvider
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