You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/03/13 16:50:48 UTC

(camel-kamelets-examples) branch main updated: CAMEL-18090: camel-main - Loading properties with profiles for prod/dev/test

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 09b274f  CAMEL-18090: camel-main - Loading properties with profiles for prod/dev/test
09b274f is described below

commit 09b274f1905fde1c9ee27ffbef5195936b8d832e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Mar 13 17:49:24 2024 +0100

    CAMEL-18090: camel-main - Loading properties with profiles for prod/dev/test
---
 jbang/main-profile/README.adoc                 | 65 ++++++++++++++++++++++++++
 jbang/main-profile/application-dev.properties  |  2 +
 jbang/main-profile/application-prod.properties |  2 +
 jbang/main-profile/application.properties      |  2 +
 jbang/main-profile/hello.camel.yaml            | 11 +++++
 5 files changed, 82 insertions(+)

diff --git a/jbang/main-profile/README.adoc b/jbang/main-profile/README.adoc
new file mode 100644
index 0000000..2e1f5e1
--- /dev/null
+++ b/jbang/main-profile/README.adoc
@@ -0,0 +1,65 @@
+== Main Profile
+
+This example shows how you can use Camel JBang with profiles
+to run for development, testing or production.
+
+=== Install JBang
+
+First install JBang according to https://www.jbang.dev
+
+When JBang is installed then you should be able to run from a shell:
+
+[source,sh]
+----
+$ jbang --version
+----
+
+This will output the version of JBang.
+
+To run this example you can either install Camel on JBang via:
+
+[source,sh]
+----
+$ jbang app install camel@apache/camel
+----
+
+Which allows to run CamelJBang with `camel` as shown below.
+
+=== How to run
+
+Then you can run this example using:
+
+[source,sh]
+----
+$ camel run hello.camel.yaml
+----
+
+This will run in developer mode by deafult (default in Camel JBang)
+
+You can run in another profile with:
+
+[source,sh]
+----
+$ camel run hello.camel.yaml --profile=production
+----
+
+And if you want to turn off profile, you can use an empty value (or none)
+
+[source,sh]
+----
+$ camel run hello.camel.yaml --profile=
+----
+
+Notice how the application prints different message depending on the selected profile.
+This is due to the loaded properties file that is profile specific.
+
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!
diff --git a/jbang/main-profile/application-dev.properties b/jbang/main-profile/application-dev.properties
new file mode 100644
index 0000000..b54f92c
--- /dev/null
+++ b/jbang/main-profile/application-dev.properties
@@ -0,0 +1,2 @@
+# configuration of value
+me = I am a developer
diff --git a/jbang/main-profile/application-prod.properties b/jbang/main-profile/application-prod.properties
new file mode 100644
index 0000000..52a3c22
--- /dev/null
+++ b/jbang/main-profile/application-prod.properties
@@ -0,0 +1,2 @@
+# configuration of value
+me = We are in production
diff --git a/jbang/main-profile/application.properties b/jbang/main-profile/application.properties
new file mode 100644
index 0000000..3b6a4d5
--- /dev/null
+++ b/jbang/main-profile/application.properties
@@ -0,0 +1,2 @@
+# configuration of value
+me = no profile in use
diff --git a/jbang/main-profile/hello.camel.yaml b/jbang/main-profile/hello.camel.yaml
new file mode 100644
index 0000000..48e5673
--- /dev/null
+++ b/jbang/main-profile/hello.camel.yaml
@@ -0,0 +1,11 @@
+# camel-k: language=yaml
+
+# Write your routes here, for example:
+- from:
+    uri: "timer:yaml"
+    parameters:
+      period: "1000"
+    steps:
+      - setBody:
+          simple: "Hello Camel from {{me}}"
+      - log: "${body}"