This is an automated email from the ASF dual-hosted git repository.
acosentino 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 9a48ad420dde CAMEL-23272: Enable main HTTP server when --port is
explicitly specified (#22355)
9a48ad420dde is described below
commit 9a48ad420dde50127a1f7b54f6829926365f0a9b
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Mar 31 14:11:08 2026 +0200
CAMEL-23272: Enable main HTTP server when --port is explicitly specified
(#22355)
When using camel run with --port and --management-port together, the REST
endpoints were incorrectly served on the management port because the main
HTTP server was never enabled. The --port option wrote camel.server.port
but not camel.server.enabled=true, so BaseMainSupport skipped creating
the main server.
This is consistent with how ExportCamelMain already handles port
configuration.
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
---
.../main/java/org/apache/camel/dsl/jbang/core/commands/Run.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
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 eebb0271e9fb..864199a38804 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
@@ -699,8 +699,12 @@ public class Run extends CamelCommand {
writeSetting(main, profileProperties,
"camel.main.durationMaxIdleSeconds",
() -> executionLimitOptions.maxIdleSeconds > 0
? String.valueOf(executionLimitOptions.maxIdleSeconds)
: null);
- if (serverOptions.port != -1 && serverOptions.port != 8080) {
- writeSetting(main, profileProperties, "camel.server.port", () ->
String.valueOf(serverOptions.port));
+ if (serverOptions.port != -1) {
+ // enable the main HTTP server when --port is explicitly specified
+ writeSetting(main, profileProperties, "camel.server.enabled",
"true");
+ if (serverOptions.port != 8080) {
+ writeSetting(main, profileProperties, "camel.server.port", ()
-> String.valueOf(serverOptions.port));
+ }
}
if (serverOptions.port == 0 && serverOptions.managementPort == -1) {
// use same port for management