From 67d3a755026640b214fddab9fa5783112face959 Mon Sep 17 00:00:00 2001 From: YaroslavVlasenko Date: Fri, 29 May 2026 14:30:07 +0300 Subject: [PATCH] TEST: Add dynamic port support for automated deployments in GettingStartedWebCloud --- .../examples/web/GettingStartedWebCloud.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/getting-started.cloud/src/main/java/fiftyone/devicedetection/examples/web/GettingStartedWebCloud.java b/web/getting-started.cloud/src/main/java/fiftyone/devicedetection/examples/web/GettingStartedWebCloud.java index 92cb45c..893a58e 100644 --- a/web/getting-started.cloud/src/main/java/fiftyone/devicedetection/examples/web/GettingStartedWebCloud.java +++ b/web/getting-started.cloud/src/main/java/fiftyone/devicedetection/examples/web/GettingStartedWebCloud.java @@ -61,8 +61,15 @@ public static void main(String[] args) throws Exception { // check resource key and set as System Property getOrSetTestResourceKey(resourceKey); - // start Jetty with this WebApp - EmbedJetty.runWebApp(resourceBase, 8081); + String portEnv = System.getenv("PORT"); + if (portEnv != null) { + // Automated runs (e.g. the unified Selenium suite) inject a port and have no + // interactive stdin, so keep the server alive by joining it instead of waiting on Enter. + EmbedJetty.startWebApp(resourceBase, Integer.parseInt(portEnv)).join(); + } else { + // start Jetty with this WebApp + EmbedJetty.runWebApp(resourceBase, 8081); + } } FlowDataProviderCore flowDataProvider = new FlowDataProviderCore.Default();