Skip to content

Commit

Permalink
fix: update code to new version of secrecy
Browse files Browse the repository at this point in the history
  • Loading branch information
c-git committed Sep 25, 2024
1 parent 59a38e9 commit 04b5138
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::str::FromStr;

use anyhow::{bail, Context as _};
use secrecy::{zeroize::DefaultIsZeroes, Secret, SecretString};
use secrecy::{zeroize::DefaultIsZeroes, SecretBox, SecretString};
use shuttle_runtime::SecretStore;
use tracing::warn;

Expand Down Expand Up @@ -46,18 +46,17 @@ impl AsRef<str> for KeyName {
impl KeyName {
pub fn get_secret_string(&self, secret_store: &SecretStore) -> anyhow::Result<SecretString> {
Ok(SecretString::new(
secret_store.access_secret_string(self.as_ref())?,
secret_store.access_secret_string(self.as_ref())?.into(),
))
}

#[allow(dead_code)] // Left implemented to not need to figure it out if we need it later
pub fn get_secret_parse<F: FromStr + DefaultIsZeroes>(
&self,
secret_store: &SecretStore,
) -> anyhow::Result<Secret<F>> {
Ok(Secret::new(
secret_store.access_secret_parse(self.as_ref())?,
))
) -> anyhow::Result<SecretBox<F>> {
let secret = secret_store.access_secret_parse::<F>(self.as_ref())?;
Ok(SecretBox::new(Box::new(secret)))
}

pub fn get_non_secret_string(&self, secret_store: &SecretStore) -> anyhow::Result<String> {
Expand Down

0 comments on commit 04b5138

Please sign in to comment.