From 52c20738f9241a7c8dd237ee1e886850e3eee7b6 Mon Sep 17 00:00:00 2001 From: Nanne Baars Date: Sun, 27 Oct 2024 08:29:14 +0100 Subject: [PATCH] fix: passing command line arguments Since we already have `webwolf.port` it makes sense to also define `webwolf.port` explicitly and not rely on `server.port` Closes: #1910 --- README.md | 10 ++++++++++ .../java/org/owasp/webgoat/server/StartWebGoat.java | 1 - src/main/resources/application-webgoat.properties | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c3f7b328..ffb686331 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,16 @@ java -Dfile.encoding=UTF-8 -jar webgoat-2023.8.jar Click the link in the log to start WebGoat. +### 3.1 Running on a different port + +If for some reason you want to run WebGoat on a different port, you can do so by adding the following parameter: + +```shell +java -jar webgoat-2023.8.jar --webgoat.port=8001 --webwolf.port=8002 +``` + +For a full overview of all the parameters you can use, please check the [WebGoat properties file](webgoat-container/src/main/resources/application-{webgoat, webwolf}.properties). + ## 4. Run from the sources ### Prerequisites: diff --git a/src/main/java/org/owasp/webgoat/server/StartWebGoat.java b/src/main/java/org/owasp/webgoat/server/StartWebGoat.java index 070eb936a..57e088d0a 100644 --- a/src/main/java/org/owasp/webgoat/server/StartWebGoat.java +++ b/src/main/java/org/owasp/webgoat/server/StartWebGoat.java @@ -28,7 +28,6 @@ package org.owasp.webgoat.server; import lombok.extern.slf4j.Slf4j; import org.owasp.webgoat.container.WebGoat; import org.owasp.webgoat.webwolf.WebWolf; -import org.springframework.boot.Banner; import org.springframework.boot.ResourceBanner; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; diff --git a/src/main/resources/application-webgoat.properties b/src/main/resources/application-webgoat.properties index 3f0cc004a..a2283b488 100644 --- a/src/main/resources/application-webgoat.properties +++ b/src/main/resources/application-webgoat.properties @@ -2,7 +2,7 @@ server.error.include-stacktrace=always server.error.path=/error.html server.servlet.context-path=${WEBGOAT_CONTEXT:/WebGoat} server.servlet.session.persistent=false -server.port=${WEBGOAT_PORT:8080} +server.port=${webgoat.port} server.address=${WEBGOAT_HOST:127.0.0.1} webgoat.host=${WEBGOAT_HOST:127.0.0.1} webgoat.port=${WEBGOAT_PORT:8080}