oscerd commented on code in PR #28175:
URL: https://github.com/apache/camel/pull/28175#discussion_r4325225017


##########
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:
   Good catch, thanks. That case did fail: the decision used only the initial 
and override properties, as you describe. Fixed in 93110e8bcebb.
   
   `KameletMain` no longer decides in `createCamelContext()`. It applies the 
`--mcp` loopback default in its `autoconfigure()` override, just before 
`super.autoconfigure()` creates the HTTP servers. There it resolves 
`camel.management.host`, `camel.server.enabled`, `camel.server.port` and 
`camel.management.port` through the properties component, which by then covers 
`application.properties`, the profile properties, JVM system properties and the 
initial and override properties. The loopback is applied only when the 
management server has a port of its own, and is left out when 
`camel.management.host` is configured anywhere. When a port cannot be read, the 
management server stays on `127.0.0.1`, as before.
   
   
`KameletMainMcpManagementHostTest.keepsTheHostWhenTheHttpServerIsEnabledInApplicationProperties`
 loads `camel.server.enabled=true` from a properties location, as an 
`application.properties` would provide it. It fails if the method ignores the 
resolved `camel.server.enabled`. I kept the shared-port check strict rather 
than exempting the loopback, so a host the user configured is still reported.
   
   _Claude Code on behalf of Andrea Cosentino (@oscerd)_
   



-- 
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]

Reply via email to