Fix passing command line arguments (#1933)
* fix: use banners correctly * 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
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
package org.owasp.webgoat.server;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("org.owasp.webgoat.server")
|
||||
public class ParentConfig {}
|
||||
|
@ -28,23 +28,30 @@ 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;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
@Slf4j
|
||||
public class StartWebGoat {
|
||||
|
||||
public static void main(String[] args) {
|
||||
var parentBuilder =
|
||||
new SpringApplicationBuilder()
|
||||
.parent(ParentConfig.class)
|
||||
.web(WebApplicationType.NONE)
|
||||
.bannerMode(Banner.Mode.OFF);
|
||||
parentBuilder.child(WebWolf.class).web(WebApplicationType.SERVLET).run(args);
|
||||
new SpringApplicationBuilder().parent(ParentConfig.class).web(WebApplicationType.NONE);
|
||||
parentBuilder
|
||||
.child(WebWolf.class)
|
||||
.banner(new ResourceBanner(new ClassPathResource("banner-webwolf.txt")))
|
||||
.web(WebApplicationType.SERVLET)
|
||||
.run(args);
|
||||
|
||||
ApplicationContext webGoatContext =
|
||||
parentBuilder.child(WebGoat.class).web(WebApplicationType.SERVLET).run(args);
|
||||
parentBuilder
|
||||
.child(WebGoat.class)
|
||||
.banner(new ResourceBanner(new ClassPathResource("banner-webgoat.txt")))
|
||||
.web(WebApplicationType.SERVLET)
|
||||
.run(args);
|
||||
|
||||
printStartUpMessage(webGoatContext);
|
||||
}
|
||||
|
Reference in New Issue
Block a user