davsclaus commented on code in PR #28175:
URL: https://github.com/apache/camel/pull/28175#discussion_r4324153766
##########
dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java:
##########
@@ -620,7 +620,9 @@ protected CamelContext createCamelContext() {
if (mcp) {
configure().httpManagementServer().withEnabled(true);
configure().httpManagementServer().withMcpEnabled(true);
- if (!isConfigured("camel.management.host")) {
+ // a management server that shares the port of the HTTP server is
served on the host of the HTTP server,
+ // and fails to start when configured with another host
+ if (!isConfigured("camel.management.host") &&
!isManagementSharingHttpServerPort()) {
Review Comment:
`isManagementSharingHttpServerPort()` only sees the initial and override
properties, and at this point `configure().httpServer()` does not yet hold the
values from `application.properties`. `camel run` loads
`application.properties` through the property placeholder locations. It only
forwards `camel.server.enabled` when `--port` is given (`Run.java`, around the
`serverOptions.port != -1` block).
So with `camel.server.enabled=true` in `application.properties` and `camel
run --mcp` (no `--port`), this still sets `127.0.0.1`. camel-main then creates
the HTTP server on 0.0.0.0:8080, and the management server now fails the
startup with `camel.management.host=127.0.0.1 (the HTTP server binds to
0.0.0.0)`, a setting the user never configured. Before this PR, that setup
started and served MCP on the HTTP server.
Could the `--mcp` loopback be treated as a default rather than a configured
host? For example, the shared-port check could ignore it, or `Run` could
forward `camel.server.enabled`, `camel.server.port` and `camel.management.port`
from the profile properties when `--mcp` is on. A test where
`camel.server.enabled=true` comes from `application.properties` would cover it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]