gnodet commented on code in PR #27667:
URL: https://github.com/apache/camel/pull/27667#discussion_r4239094457


##########
dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MainHttpServerFactory.java:
##########
@@ -56,6 +70,37 @@ public static MainHttpServer setupHttpServer(CamelContext 
camelContext, boolean
         return server;
     }
 
+    /**
+     * Binds the camel.server.* properties (application.properties, 
--properties, initial and override properties and
+     * JVM system properties) on the configuration of the HTTP server that is 
started implicitly for platform-http, as
+     * camel-main only applies them to the server it starts itself when 
camel.server.enabled=true.
+     */
+    static void configureHttpServer(CamelContext camelContext, 
HttpServerConfigurationProperties config) {
+        OrderedLocationProperties prop = (OrderedLocationProperties) 
camelContext.getPropertiesComponent()
+                .loadProperties(name -> startsWithIgnoreCase(name, 
PREFIX_SERVER), MainHelper::optionKey);
+        Properties propJVM = 
MainHelper.loadJvmSystemPropertiesAsProperties(new String[] { PREFIX_SERVER });
+        for (String key : propJVM.stringPropertyNames()) {
+            prop.put("SYS", MainHelper.optionKey(key), 
propJVM.getProperty(key));
+        }
+
+        OrderedLocationProperties options = new OrderedLocationProperties();
+        for (Object k : prop.keySet()) {
+            String key = k.toString();
+            if (startsWithIgnoreCase(key, PREFIX_SERVER)) {

Review Comment:
   💡 **Suggestion (minor):** The `startsWithIgnoreCase(key, PREFIX_SERVER)` 
guard inside this loop appears to be dead code.
   
   Both sources of keys in `prop` start with `camel.server.`:
   - `loadProperties(name -> startsWithIgnoreCase(name, PREFIX_SERVER), 
MainHelper::optionKey)` — the filter ensures it, and `optionKey` 
(dash-to-camelCase) preserves the `camel.server.` prefix
   - The JVM property merge just above also filters on `PREFIX_SERVER` before 
inserting into `prop`
   
   The `if` is never false, so it and its outer `}` can be removed — 
simplifying the loop to just the inner `if (!"enabled"...)` guard.



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