chore: make kms decryption optional if partial auth not enabled (#5779)

This commit is contained in:
Nishant Joshi
2024-09-10 13:22:39 +05:30
committed by GitHub
parent 3a5fb532de
commit aaeb192576

View File

@ -115,16 +115,22 @@ impl SecretsHandler for settings::ApiKeys {
let expiry_reminder_days = api_keys.expiry_reminder_days.clone();
#[cfg(feature = "partial-auth")]
let checksum_auth_context = secret_management_client
.get_secret(api_keys.checksum_auth_context.clone())
.await?;
#[cfg(feature = "partial-auth")]
let checksum_auth_key = secret_management_client
.get_secret(api_keys.checksum_auth_key.clone())
.await?;
let enable_partial_auth = api_keys.enable_partial_auth;
#[cfg(feature = "partial-auth")]
let enable_partial_auth = api_keys.enable_partial_auth;
let (checksum_auth_context, checksum_auth_key) = {
if enable_partial_auth {
let checksum_auth_context = secret_management_client
.get_secret(api_keys.checksum_auth_context.clone())
.await?;
let checksum_auth_key = secret_management_client
.get_secret(api_keys.checksum_auth_key.clone())
.await?;
(checksum_auth_context, checksum_auth_key)
} else {
(String::new().into(), String::new().into())
}
};
Ok(value.transition_state(|_| Self {
hash_key,