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 2021/11/22 12:01:36 UTC
[camel] branch main updated: [CAMEL-17216] Allow to include properties file (#6459)
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.git
The following commit(s) were added to refs/heads/main by this push:
new 1c79dc4 [CAMEL-17216] Allow to include properties file (#6459)
1c79dc4 is described below
commit 1c79dc40c8ba51f15734bd52ad50b821cdc2b6c9
Author: Federico Mariani <34...@users.noreply.github.com>
AuthorDate: Mon Nov 22 13:01:05 2021 +0100
[CAMEL-17216] Allow to include properties file (#6459)
---
.../apache/camel/dsl/jbang/core/commands/Run.java | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index 528e05e..fc36ec2 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -19,6 +19,7 @@ package org.apache.camel.dsl.jbang.core.commands;
import java.io.File;
import java.io.IOException;
+import java.nio.file.FileSystems;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -65,6 +66,10 @@ class Run implements Callable<Integer> {
@Option(names = { "--reload" }, description = "Enables live reload when source file is changed (saved)")
private boolean reload;
+ @Option(names = { "--properties" },
+ description = "Load properties file for route placeholders (ex. /path/to/file.properties")
+ private String propertiesFiles;
+
@Option(names = { "--file-lock" }, defaultValue = "true",
description = "Whether to create a temporary file lock, which upon deleting triggers this process to terminate")
private boolean fileLock = true;
@@ -155,6 +160,24 @@ class Run implements Callable<Integer> {
}
}
+ if (propertiesFiles != null) {
+ String[] filesLocation = propertiesFiles.split(",");
+ StringBuilder locations = new StringBuilder();
+ for (String file : filesLocation) {
+ if (!file.startsWith("file:")) {
+ if (!file.startsWith("/")) {
+ file = FileSystems.getDefault().getPath("").toAbsolutePath() + File.separator + file;
+ }
+
+ file = "file://" + file;
+ }
+
+ locations.append(file).append(",");
+ }
+
+ main.addInitialProperty("camel.component.properties.location", locations.toString());
+ }
+
System.out.println("Starting Camel JBang!");
main.start();