Bug: [FEATURE] Create a delete endpoint for Config Table



### Feature Description

Add an API for deleting data from config table.

### Possible Implementation

Add the endpoint DELETE `config/{key}` for deleting the config key.

### Have you spent some time checking if this feature request has been raised before?

- [X] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [X] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

None
diff --git a/crates/diesel_models/src/query/configs.rs b/crates/diesel_models/src/query/configs.rs
index 62ed60e3b0a..306fb5e3353 100644
--- a/crates/diesel_models/src/query/configs.rs
+++ b/crates/diesel_models/src/query/configs.rs
@@ -50,8 +50,11 @@ impl Config {
     }
 
     #[instrument(skip(conn))]
-    pub async fn delete_by_key(conn: &PgPooledConn, key: &str) -> StorageResult<bool> {
-        generics::generic_delete::<<Self as HasTable>::Table, _>(conn, dsl::key.eq(key.to_owned()))
-            .await
+    pub async fn delete_by_key(conn: &PgPooledConn, key: &str) -> StorageResult<Self> {
+        generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(
+            conn,
+            dsl::key.eq(key.to_owned()),
+        )
+        .await
     }
 }
diff --git a/crates/router/src/core/configs.rs b/crates/router/src/core/configs.rs
index 8aa2310416e..ba2303167d7 100644
--- a/crates/router/src/core/configs.rs
+++ b/crates/router/src/core/configs.rs
@@ -41,3 +41,12 @@ pub async fn update_config(
         .to_not_found_response(errors::ApiErrorResponse::ConfigNotFound)?;
     Ok(ApplicationResponse::Json(config.foreign_into()))
 }
+
+pub async fn config_delete(state: AppState, key: String) -> RouterResponse<api::Config> {
+    let store = state.store.as_ref();
+    let config = store
+        .delete_config_by_key(&key)
+        .await
+        .to_not_found_response(errors::ApiErrorResponse::ConfigNotFound)?;
+    Ok(ApplicationResponse::Json(config.foreign_into()))
+}
diff --git a/crates/router/src/db/configs.rs b/crates/router/src/db/configs.rs
index f3e85ba5d23..1d472c1fb66 100644
--- a/crates/router/src/db/configs.rs
+++ b/crates/router/src/db/configs.rs
@@ -51,7 +51,10 @@ pub trait ConfigInterface {
         config_update: storage::ConfigUpdate,
     ) -> CustomResult<storage::Config, errors::StorageError>;
 
-    async fn delete_config_by_key(&self, key: &str) -> CustomResult<bool, errors::StorageError>;
+    async fn delete_config_by_key(
+        &self,
+        key: &str,
+    ) -> CustomResult<storage::Config, errors::StorageError>;
 }
 
 #[async_trait::async_trait]
@@ -154,7 +157,10 @@ impl ConfigInterface for Store {
         cache::get_or_populate_in_memory(self, key, find_else_unwrap_or, &CONFIG_CACHE).await
     }
 
-    async fn delete_config_by_key(&self, key: &str) -> CustomResult<bool, errors::StorageError> {
+    async fn delete_config_by_key(
+        &self,
+        key: &str,
+    ) -> CustomResult<storage::Config, errors::StorageError> {
         let conn = connection::pg_connection_write(self).await?;
         let deleted = storage::Config::delete_by_key(&conn, key)
             .await
@@ -226,15 +232,15 @@ impl ConfigInterface for MockDb {
         result
     }
 
-    async fn delete_config_by_key(&self, key: &str) -> CustomResult<bool, errors::StorageError> {
+    async fn delete_config_by_key(
+        &self,
+        key: &str,
+    ) -> CustomResult<storage::Config, errors::StorageError> {
         let mut configs = self.configs.lock().await;
         let result = configs
             .iter()
             .position(|c| c.key == key)
-            .map(|index| {
-                configs.remove(index);
-                true
-            })
+            .map(|index| configs.remove(index))
             .ok_or_else(|| {
                 errors::StorageError::ValueNotFound("cannot find config to delete".to_string())
                     .into()
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 0897deb87e5..3b88868001a 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -284,7 +284,10 @@ impl ConfigInterface for KafkaStore {
             .await
     }
 
-    async fn delete_config_by_key(&self, key: &str) -> CustomResult<bool, errors::StorageError> {
+    async fn delete_config_by_key(
+        &self,
+        key: &str,
+    ) -> CustomResult<storage::Config, errors::StorageError> {
         self.diesel_store.delete_config_by_key(key).await
     }
 
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 41881c60ff7..3a94aef623b 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -813,7 +813,8 @@ impl Configs {
             .service(
                 web::resource("/{key}")
                     .route(web::get().to(config_key_retrieve))
-                    .route(web::post().to(config_key_update)),
+                    .route(web::post().to(config_key_update))
+                    .route(web::delete().to(config_key_delete)),
             )
     }
 }
diff --git a/crates/router/src/routes/configs.rs b/crates/router/src/routes/configs.rs
index 45eb45a83b5..d7e96f40235 100644
--- a/crates/router/src/routes/configs.rs
+++ b/crates/router/src/routes/configs.rs
@@ -71,3 +71,24 @@ pub async fn config_key_update(
     )
     .await
 }
+
+#[instrument(skip_all, fields(flow = ?Flow::ConfigKeyDelete))]
+pub async fn config_key_delete(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    path: web::Path<String>,
+) -> impl Responder {
+    let flow = Flow::ConfigKeyDelete;
+    let key = path.into_inner();
+
+    api::server_wrap(
+        flow,
+        state,
+        &req,
+        key,
+        |state, _, key| configs::config_delete(state, key),
+        &auth::AdminApiAuth,
+        api_locking::LockAction::NotApplicable,
+    )
+    .await
+}
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 9393e8ae212..aa4f3dccb8f 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -74,6 +74,7 @@ impl From<Flow> for ApiIdentifier {
             Flow::ConfigKeyCreate
             | Flow::ConfigKeyFetch
             | Flow::ConfigKeyUpdate
+            | Flow::ConfigKeyDelete
             | Flow::CreateConfigKey => Self::Configs,
 
             Flow::CustomersCreate
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 6649b89911a..b99b81f8d6b 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -82,6 +82,8 @@ pub enum Flow {
     ConfigKeyFetch,
     /// ConfigKey Update flow.
     ConfigKeyUpdate,
+    /// ConfigKey Delete flow.
+    ConfigKeyDelete,
     /// Customers create flow.
     CustomersCreate,
     /// Customers retrieve flow.

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
Added the api to delete config key
Fixes #3488 



<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Create a config. 
```bash
curl --location 'http://localhost:8080/configs/' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "key":"keke",
    "value": "keke"
}'
```
- Delete the config
```bash
curl --location --request DELETE 'http://localhost:8080/configs/keke' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin'
```
- Get the config
```
curl --location --request GET 'http://localhost:8080/configs/keke' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin'
```
It should return 404

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code