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
commit 221fb7605d9a4e162cd3fc692552ee07ffbc2d39 Author: Andrea Cosentino <[email protected]> AuthorDate: Tue Sep 13 14:08:12 2022 +0200 CAMEL-18502 - Support Secrets Reload from Vault/Cloud Service in camel-spring-boot - Google Secret Manager --- .../boot/vault/GcpVaultAutoConfiguration.java | 5 ++- .../vault/GcpVaultConfigurationProperties.java | 52 ++++++++++++++++++++++ .../boot/vault/GcpVaultConfigurationTest.java | 7 ++- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultAutoConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultAutoConfiguration.java index 6b53399ac58..de03063a38e 100644 --- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultAutoConfiguration.java +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultAutoConfiguration.java @@ -17,7 +17,6 @@ package org.apache.camel.spring.boot.vault; import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.vault.AwsVaultConfiguration; import org.apache.camel.vault.GcpVaultConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -37,6 +36,10 @@ public class GcpVaultAutoConfiguration { answer.setServiceAccountKey(config.getServiceAccountKey()); answer.setProjectId(config.getProjectId()); answer.setUseDefaultInstance(config.isUseDefaultInstance()); + answer.setRefreshEnabled(config.isRefreshEnabled()); + answer.setRefreshPeriod(config.getRefreshPeriod()); + answer.setSecrets(config.getSecrets()); + answer.setSubscriptionName(config.getSubscriptionName()); return answer; } diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationProperties.java index 566083464c9..c19251c1378 100644 --- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationProperties.java +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationProperties.java @@ -36,6 +36,26 @@ public class GcpVaultConfigurationProperties { * Define if we want to use the GCP Client Default Instance or not */ private boolean useDefaultInstance; + + /** + * Define the Google Pubsub subscription Name to be used when checking for updates + */ + private String subscriptionName; + + /** + * Define if we want to refresh the secrets on update + */ + private boolean refreshEnabled; + + /** + * Define the refresh period + */ + private long refreshPeriod = 30000; + + /** + * Define the secrets to look at + */ + private String secrets; public String getServiceAccountKey() { return serviceAccountKey; @@ -60,4 +80,36 @@ public class GcpVaultConfigurationProperties { public void setUseDefaultInstance(boolean useDefaultInstance) { this.useDefaultInstance = useDefaultInstance; } + + public String getSubscriptionName() { + return subscriptionName; + } + + public void setSubscriptionName(String subscriptionName) { + this.subscriptionName = subscriptionName; + } + + 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/GcpVaultConfigurationTest.java b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationTest.java index c3f244d5da1..47ed0fdf841 100644 --- a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationTest.java +++ b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/GcpVaultConfigurationTest.java @@ -33,7 +33,12 @@ import org.springframework.test.annotation.DirtiesContext; GcpVaultConfigurationTest.class}, properties = { "camel.vault.gcp.serviceAccountKey=file:////key.json", - "camel.vault.gcp.projectId=gcp-project"} + "camel.vault.gcp.projectId=gcp-project,", + "camel.vault.gcp.subscriptionName=sub-1", + "camel.vault.gcp.refreshEnabled=true,", + "camel.vault.gcp.refreshPeriod=300000,", + "camel.vault.gcp.secrets=hello*," + } ) public class GcpVaultConfigurationTest {
