This is an automated email from the ASF dual-hosted git repository. cdeppisch 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 0a9cbbf3f66 CAMEL-21893: EnvVar settings should overwrite default Kamelet property values 0a9cbbf3f66 is described below commit 0a9cbbf3f6668bde4d5eccaa0c66da9b3b23ed73 Author: Christoph Deppisch <cdeppi...@redhat.com> AuthorDate: Tue Mar 25 10:21:43 2025 +0100 CAMEL-21893: EnvVar settings should overwrite default Kamelet property values - Make sure to use the property set via environment variables when the Kamelet property has a default value - Only use the default Kamelet property value as a fallback when not set explicitly --- .../src/main/java/org/apache/camel/impl/DefaultModel.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java index 7da3b7d416e..e213146adbb 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java @@ -485,12 +485,12 @@ public class DefaultModel implements Model { StringJoiner missingParameters = new StringJoiner(", "); for (RouteTemplateParameterDefinition temp : target.getTemplateParameters()) { - if (temp.getDefaultValue() != null) { - addProperty(prop, temp.getName(), temp.getDefaultValue()); - addProperty(propDefaultValues, temp.getName(), temp.getDefaultValue()); - } else if (routeTemplateContext.hasEnvironmentVariable(temp.getName())) { + if (routeTemplateContext.hasEnvironmentVariable(temp.getName())) { // property is configured via environment variables addProperty(prop, temp.getName(), routeTemplateContext.getEnvironmentVariable(temp.getName())); + } else if (temp.getDefaultValue() != null) { + addProperty(prop, temp.getName(), temp.getDefaultValue()); + addProperty(propDefaultValues, temp.getName(), temp.getDefaultValue()); } else if (temp.isRequired() && !routeTemplateContext.hasParameter(temp.getName())) { // this is a required parameter which is missing missingParameters.add(temp.getName());