You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2025/01/21 13:33:33 UTC
(camel) 01/02: CAMEL-21640 - Camel-Hashicorp-Vault: Support Hashicorp Cloud deployment in properties function - Docs
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch CAMEL-21640
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b5422f08ff8474c8f5ec16c17a237f8c6cf60853
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Jan 21 14:17:15 2025 +0100
CAMEL-21640 - Camel-Hashicorp-Vault: Support Hashicorp Cloud deployment in properties function - Docs
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../src/main/docs/hashicorp-vault-component.adoc | 34 +++++++++++++++++++---
.../vault/HashicorpVaultPropertiesFunction.java | 3 ++
2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc b/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
index 88e5f674cfd..5393d6e06ad 100644
--- a/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
+++ b/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
@@ -55,10 +55,10 @@ To use this function, you'll need to provide credentials for Hashicorp vault as
[source,bash]
----
-export $CAMEL_VAULT_HASHICORP_TOKEN=token
-export $CAMEL_VAULT_HASHICORP_HOST=host
-export $CAMEL_VAULT_HASHICORP_PORT=port
-export $CAMEL_VAULT_HASHICORP_SCHEME=http/https
+export CAMEL_VAULT_HASHICORP_TOKEN=token
+export CAMEL_VAULT_HASHICORP_HOST=host
+export CAMEL_VAULT_HASHICORP_PORT=port
+export CAMEL_VAULT_HASHICORP_SCHEME=http/https
----
You can also configure the credentials in the `application.properties` file such as:
@@ -71,6 +71,32 @@ camel.vault.hashicorp.port = port
camel.vault.hashicorp.scheme = scheme
----
+In case the running Hashicorp Vault instance you're pointing is running on Hashicorp Cloud, the configuration will require two additional parameters:
+
+[source,bash]
+----
+export CAMEL_VAULT_HASHICORP_TOKEN=token
+export CAMEL_VAULT_HASHICORP_HOST=host
+export CAMEL_VAULT_HASHICORP_PORT=port
+export CAMEL_VAULT_HASHICORP_SCHEME=http/https
+export CAMEL_HASHICORP_VAULT_CLOUD=true
+export CAMEL_HASHICORP_VAULT_NAMESPACE=namespace
+----
+
+You can also set the same in the `application.properties` file such as:
+
+[source,properties]
+----
+camel.vault.hashicorp.token = token
+camel.vault.hashicorp.host = host
+camel.vault.hashicorp.port = port
+camel.vault.hashicorp.scheme = scheme
+camel.vault.hashicorp.cloud = true
+camel.vault.hashicorp.namespace = namespace
+----
+
+This will make the Properties function works even in the Hashicorp Cloud deployment option.
+
NOTE: if you're running the application on a Kubernetes based cloud platform, you can initialize the environment variables from a Secret or Configmap to enhance security. You can also enhance security by xref:manual::using-propertyplaceholder.adoc#_resolving_property_placeholders_on_cloud[setting a Secret property placeholder] which will be initialized at application runtime only.
NOTE: `camel.vault.hashicorp` configuration only applies to the Hashicorp Vault properties function (E.g when resolving properties).
diff --git a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
index 93bafc3685e..5f4230f66ab 100644
--- a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
+++ b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java
@@ -103,6 +103,9 @@ public class HashicorpVaultPropertiesFunction extends ServiceSupport implements
String host = System.getenv(CAMEL_HASHICORP_VAULT_HOST_ENV);
String port = System.getenv(CAMEL_HASHICORP_VAULT_PORT_ENV);
String scheme = System.getenv(CAMEL_HASHICORP_VAULT_SCHEME_ENV);
+ if (System.getenv(CAMEL_HASHICORP_VAULT_CLOUD_ENV) != null) {
+ cloud = Boolean.parseBoolean(System.getenv(CAMEL_HASHICORP_VAULT_CLOUD_ENV));
+ }
namespace = System.getenv(CAMEL_HASHICORP_VAULT_NAMESPACE_ENV);
if (ObjectHelper.isEmpty(token) && ObjectHelper.isEmpty(host)
&& ObjectHelper.isEmpty(port) && ObjectHelper.isEmpty(scheme) && ObjectHelper.isEmpty(namespace)) {