feat: add env variable for enable key manager service (#5442)

Co-authored-by: dracarys18 <karthikey.hegde@juspay.in>
This commit is contained in:
Arjun Karthik
2024-07-29 14:31:30 +05:30
committed by GitHub
parent 00f8ceceb9
commit db26d32d84
7 changed files with 65 additions and 83 deletions

View File

@ -8936,6 +8936,7 @@ impl Default for super::settings::ApiKeys {
impl Default for super::settings::KeyManagerConfig {
fn default() -> Self {
Self {
enabled: None,
url: String::from("localhost:5000"),
#[cfg(feature = "keymanager_mtls")]
ca: String::default().into(),

View File

@ -210,6 +210,7 @@ pub struct KvConfig {
#[derive(Debug, Deserialize, Clone)]
pub struct KeyManagerConfig {
pub enabled: Option<bool>,
pub url: String,
#[cfg(feature = "keymanager_mtls")]
pub cert: Secret<String>,

View File

@ -772,7 +772,7 @@ pub async fn merchant_account_transfer_keys(
payload: web::Json<api_models::admin::MerchantKeyTransferRequest>,
) -> HttpResponse {
let flow = Flow::ConfigKeyFetch;
api::server_wrap(
Box::pin(api::server_wrap(
flow,
state,
&req,
@ -780,7 +780,7 @@ pub async fn merchant_account_transfer_keys(
|state, _, req, _| transfer_key_store_to_key_manager(state, req),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
)
))
.await
}

View File

@ -8,6 +8,7 @@ impl From<&crate::SessionState> for KeyManagerState {
fn from(state: &crate::SessionState) -> Self {
let conf = state.conf.key_manager.get_inner();
Self {
enabled: conf.enabled,
url: conf.url.clone(),
client_idle_timeout: state.conf.proxy.idle_pool_connection_timeout,
#[cfg(feature = "keymanager_mtls")]