This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 2ec2969be57 CAMEL-22677 - Camel-Hashicorp-Vault starter: Support 
Secret Refresh (#1566)
2ec2969be57 is described below

commit 2ec2969be57158b4fe6449fdab5641b02777a9ed
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Nov 10 15:28:11 2025 +0100

    CAMEL-22677 - Camel-Hashicorp-Vault starter: Support Secret Refresh (#1566)
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../src/main/docs/spring-boot.json                 | 26 ++++++++---
 .../vault/HashicorpVaultAutoConfiguration.java     |  3 ++
 .../HashicorpVaultConfigurationProperties.java     | 52 ++++++++++++++++------
 .../vault/HashicorpVaultConfigurationTest.java     |  8 +++-
 4 files changed, 68 insertions(+), 21 deletions(-)

diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json 
b/core/camel-spring-boot/src/main/docs/spring-boot.json
index 909f6df371c..ae91b559094 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -1973,12 +1973,6 @@
       "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties",
       "defaultValue": false
     },
-    {
-      "name": "camel.vault.hashicorp.engine",
-      "type": "java.lang.String",
-      "description": "The Hashicorp Vault Engine for accessing secrets",
-      "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties"
-    },
     {
       "name": "camel.vault.hashicorp.host",
       "type": "java.lang.String",
@@ -1997,12 +1991,32 @@
       "description": "The Hashicorp Vault port for accessing the service",
       "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties"
     },
+    {
+      "name": "camel.vault.hashicorp.refresh-enabled",
+      "type": "java.lang.Boolean",
+      "description": "Whether to automatically reload Camel upon secrets being 
updated in Hashicorp Vault",
+      "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties",
+      "defaultValue": false
+    },
+    {
+      "name": "camel.vault.hashicorp.refresh-period",
+      "type": "java.lang.Long",
+      "description": "The period (millis) between checking Hashicorp Vault for 
updated secrets",
+      "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties",
+      "defaultValue": 60000
+    },
     {
       "name": "camel.vault.hashicorp.scheme",
       "type": "java.lang.String",
       "description": "The Hashicorp Vault Scheme for accessing the service",
       "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties"
     },
+    {
+      "name": "camel.vault.hashicorp.secrets",
+      "type": "java.lang.String",
+      "description": "Specify the secret names (or pattern) to check for 
updates. Multiple secrets can be separated by comma",
+      "sourceType": 
"org.apache.camel.spring.boot.vault.HashicorpVaultConfigurationProperties"
+    },
     {
       "name": "camel.vault.hashicorp.token",
       "type": "java.lang.String",
diff --git 
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultAutoConfiguration.java
 
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultAutoConfiguration.java
index 2daf4a43447..26379a192ca 100644
--- 
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultAutoConfiguration.java
+++ 
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultAutoConfiguration.java
@@ -39,6 +39,9 @@ public class HashicorpVaultAutoConfiguration {
         answer.setScheme(config.getScheme());
         answer.setCloud(config.isCloud());
         answer.setNamespace(config.getNamespace());
+        answer.setRefreshEnabled(config.isRefreshEnabled());
+        answer.setRefreshPeriod(config.getRefreshPeriod());
+        answer.setSecrets(config.getSecrets());
         return answer;
     }
 
diff --git 
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationProperties.java
 
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationProperties.java
index 8dec145df13..86a21d0968a 100644
--- 
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationProperties.java
+++ 
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationProperties.java
@@ -27,11 +27,6 @@ public class HashicorpVaultConfigurationProperties {
      */
     private String token;
 
-    /**
-     * The Hashicorp Vault Engine for accessing secrets
-     */
-    private String engine;
-
     /**
      * The Hashicorp Vault Host for accessing the service
      */
@@ -57,6 +52,21 @@ public class HashicorpVaultConfigurationProperties {
      */
     private String namespace;
 
+    /**
+     * Whether to automatically reload Camel upon secrets being updated in 
Hashicorp Vault
+     */
+    private boolean refreshEnabled;
+
+    /**
+     * The period (millis) between checking Hashicorp Vault for updated secrets
+     */
+    private long refreshPeriod = 60000;
+
+    /**
+     * Specify the secret names (or pattern) to check for updates. Multiple 
secrets can be separated by comma
+     */
+    private String secrets;
+
     public String getToken() {
         return token;
     }
@@ -65,14 +75,6 @@ public class HashicorpVaultConfigurationProperties {
         this.token = token;
     }
 
-    public String getEngine() {
-        return engine;
-    }
-
-    public void setEngine(String engine) {
-        this.engine = engine;
-    }
-
     public String getHost() {
         return host;
     }
@@ -112,4 +114,28 @@ public class HashicorpVaultConfigurationProperties {
     public void setNamespace(String namespace) {
         this.namespace = namespace;
     }
+
+    public boolean isRefreshEnabled() {
+        return refreshEnabled;
+    }
+
+    public void setRefreshEnabled(boolean refreshEnabled) {
+        this.refreshEnabled = refreshEnabled;
+    }
+
+    public long getRefreshPeriod() {
+        return refreshPeriod;
+    }
+
+    public void setRefreshPeriod(long refreshPeriod) {
+        this.refreshPeriod = refreshPeriod;
+    }
+
+    public String getSecrets() {
+        return secrets;
+    }
+
+    public void setSecrets(String secrets) {
+        this.secrets = secrets;
+    }
 }
diff --git 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationTest.java
 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationTest.java
index 69c9cf2ca19..782dc25c0ae 100644
--- 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationTest.java
+++ 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/HashicorpVaultConfigurationTest.java
@@ -31,17 +31,21 @@ import org.springframework.test.annotation.DirtiesContext;
 @SpringBootTest(classes = { HashicorpVaultConfigurationTest.class }, 
properties = {
         "camel.vault.hashicorp.token=myToken",
         "camel.vault.hashicorp.host=myHost", 
"camel.vault.hashicorp.port=myPort",
-        "camel.vault.hashicorp.scheme=myScheme" })
+        "camel.vault.hashicorp.scheme=myScheme", 
"camel.vault.hashicorp.refreshEnabled=true",
+        "camel.vault.hashicorp.refreshPeriod=10000", 
"camel.vault.hashicorp.secrets=secret1,secret2" })
 public class HashicorpVaultConfigurationTest {
 
     @Autowired
     private CamelContext camelContext;
 
     @Test
-    public void testAwsVault() throws Exception {
+    public void testHashicorpVault() throws Exception {
         Assertions.assertEquals("myToken", 
camelContext.getVaultConfiguration().hashicorp().getToken());
         Assertions.assertEquals("myHost", 
camelContext.getVaultConfiguration().hashicorp().getHost());
         Assertions.assertEquals("myPort", 
camelContext.getVaultConfiguration().hashicorp().getPort());
         Assertions.assertEquals("myScheme", 
camelContext.getVaultConfiguration().hashicorp().getScheme());
+        Assertions.assertEquals(true, 
camelContext.getVaultConfiguration().hashicorp().isRefreshEnabled());
+        Assertions.assertEquals(10000, 
camelContext.getVaultConfiguration().hashicorp().getRefreshPeriod());
+        Assertions.assertEquals("secret1,secret2", 
camelContext.getVaultConfiguration().hashicorp().getSecrets());
     }
 }

Reply via email to