gnodet-bot commented on code in PR #26542:
URL: https://github.com/apache/camel/pull/26542#discussion_r4035024055


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportSpringBoot.java:
##########
@@ -160,8 +163,26 @@ public Integer export() throws Exception {
                 prop.setProperty("spring.jmx.enabled", "true");
                 prop.setProperty("hawtio.authenticationEnabled", "false");
             }
+            // developer console (--console) is the camel actuator endpoint 
(/actuator/camel)
+            if (settingsFlag(settings, CamelJBangConstants.CONSOLE)) {
+                addConsoleProperties(prop, devProfile, 
Map.of("camel.main.devConsoleEnabled", "true"));
+                // the camel endpoint must be exposed, keeping what is already 
exposed as the profile replaces the
+                // value. With --observe the starter exposes health and 
prometheus as its default, which an explicit
+                // list would replace, so keep them too (the console is then 
at /observe/camel)
+                String exposed = 
prop.getProperty("management.endpoints.web.exposure.include");
+                if (exposed == null && observe) {
+                    exposed = "health,prometheus";
+                }
+                exposed = exposed == null ? "camel" : exposed + ",camel";

Review Comment:
   💡 **Nit (same as hawtio's append — still no dedup):** If the user's 
`application.properties` already contains `"camel"` in 
`management.endpoints.web.exposure.include`, this produces `"…,camel,camel"`. 
Spring Boot silently ignores the duplicate, but the exported file is 
misleading. Same pattern the previous review flagged in the `hawtio` block. 
Both should use a `LinkedHashSet` merge:
   
   ```suggestion
                   Set<String> ids = new java.util.LinkedHashSet<>();
                   if (exposed != null) {
                       for (String id : exposed.split(",")) {
                           String t = id.strip();
                           if (!t.isEmpty()) ids.add(t);
                       }
                   }
                   ids.add("camel");
                   exposed = String.join(",", ids);
   ```



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