This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch pr/CAMEL-24705 in repository https://gitbox.apache.org/repos/asf/camel.git
commit c2a44e79b452007b9d7d0f9495cf2a3526fe8e4a Author: Claus Ibsen <[email protected]> AuthorDate: Sun Sep 13 15:08:33 2026 +0200 CAMEL-24705: camel-jbang - a CLI flag wins over the same option in application.properties Squash of the 1 commits on fix/CAMEL-24705 (the run-by-run history is on bench/after-run). camel-jbang - a flag given on the command line (--max-seconds, --max-messages, --max-idle-seconds) wins over application.properties Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj --- .../java/org/apache/camel/dsl/jbang/core/commands/Run.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 2d6a6f64afae..ea049bba5f11 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 @@ -632,7 +632,19 @@ public class Run extends CamelCommand { } private void writeSetting(KameletMain main, Properties existing, String key, Supplier<String> value) { - String val = existing != null ? existing.getProperty(key, value.get()) : value.get(); + // a flag given on the command line (the supplier answers non-null only then) wins over the profile + // properties file; the file is the default when the flag is not given (CAMEL-24705) + String val = value.get(); + if (val != null) { + // an explicit flag: an override property, as camel-main loads application.properties itself on top of + // the initial properties and the file would win otherwise + main.addOverrideProperty(key, val); + writeSettings(key, val); + return; + } + if (existing != null) { + val = existing.getProperty(key); + } if (val != null) { main.addInitialProperty(key, val); writeSettings(key, val);
