You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "jamesnetherton (via GitHub)" <gi...@apache.org> on 2023/05/09 06:25:27 UTC

[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #4875: Improve test coverage for vertx-websocket

jamesnetherton commented on code in PR #4875:
URL: https://github.com/apache/camel-quarkus/pull/4875#discussion_r1188184652


##########
extensions/vertx-websocket/runtime/src/main/java/org/apache/camel/quarkus/component/vertx/websocket/VertxWebsocketRecorder.java:
##########
@@ -16,27 +16,67 @@
  */
 package org.apache.camel.quarkus.component.vertx.websocket;
 
+import java.net.URI;
 import java.util.concurrent.ExecutionException;
 
+import io.quarkus.runtime.LaunchMode;
 import io.quarkus.runtime.RuntimeValue;
 import io.quarkus.runtime.annotations.Recorder;
+import io.quarkus.vertx.http.runtime.CertificateConfig;
+import io.quarkus.vertx.http.runtime.HttpConfiguration;
+import io.quarkus.vertx.http.runtime.ServerSslConfig;
 import io.vertx.core.Vertx;
+import io.vertx.core.http.HttpClientOptions;
+import io.vertx.core.http.WebSocketConnectOptions;
 import io.vertx.ext.web.Router;
 import org.apache.camel.CamelContext;
 import org.apache.camel.component.vertx.websocket.VertxWebsocketComponent;
+import org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration;
+import org.apache.camel.component.vertx.websocket.VertxWebsocketConstants;
+import org.apache.camel.component.vertx.websocket.VertxWebsocketEndpoint;
 import org.apache.camel.component.vertx.websocket.VertxWebsocketHost;
 import org.apache.camel.component.vertx.websocket.VertxWebsocketHostConfiguration;
 import org.apache.camel.component.vertx.websocket.VertxWebsocketHostKey;
 import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.util.ObjectHelper;
 
 @Recorder
 public class VertxWebsocketRecorder {
+    private static volatile int PORT;
+    private static volatile String HOST;
+
+    public RuntimeValue<VertxWebsocketComponent> createVertxWebsocketComponent(
+            RuntimeValue<Vertx> vertx,
+            RuntimeValue<Router> router,
+            LaunchMode launchMode,
+            HttpConfiguration httpConfig) {
+
+        boolean sslEnabled = false;
+        int httpPort = httpConfig.determinePort(launchMode);
+        int httpsPort = httpConfig.determineSslPort(launchMode);
+
+        ServerSslConfig ssl = httpConfig.ssl;
+        if (ssl != null) {
+            CertificateConfig certificate = ssl.certificate;
+            if (certificate != null) {
+                if (certificate.files.isPresent() && certificate.keyFiles.isPresent()) {
+                    sslEnabled = true;
+                }
+
+                if (certificate.keyStoreFile.isPresent() && certificate.keyStorePassword.isPresent()) {
+                    sslEnabled = true;
+                }

Review Comment:
   @ppalaga I could add something if you feel it is necessary. Although, Quarkus does not even validate this. It will silently fallback to HTTP.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org