Consistent environment values and url references (#1677)
* organizing environment variables * Update application-webgoat.properties * Update pom.xml * test without ssl * fix docker base image and default env entries * seperate server.address from webgoat.host and webwolf.host * change base image and enable endpoint logging for docker as well * change README * change README * make integration test able to verify against alternative host names * use dynamic ports and remove system println
This commit is contained in:
@ -17,6 +17,11 @@ public class StartupMessage {
|
||||
private String address;
|
||||
private String contextPath;
|
||||
|
||||
private String applicationName;
|
||||
|
||||
private static boolean useSSL =
|
||||
Boolean.valueOf(System.getenv().getOrDefault("WEBGOAT_SSLENABLED", "true"));
|
||||
|
||||
@EventListener
|
||||
void onStartup(ApplicationReadyEvent event) {
|
||||
|
||||
@ -24,9 +29,24 @@ public class StartupMessage {
|
||||
address = event.getApplicationContext().getEnvironment().getProperty("server.address");
|
||||
contextPath =
|
||||
event.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path");
|
||||
if (StringUtils.hasText(port)
|
||||
&& !StringUtils.hasText(System.getProperty("running.in.docker"))) {
|
||||
log.warn("Please browse to http://{}:{}{} to get started...", address, port, contextPath);
|
||||
applicationName =
|
||||
event.getApplicationContext().getEnvironment().getProperty("spring.application.name");
|
||||
if (StringUtils.hasText(applicationName)) {
|
||||
if (applicationName.equals("WebGoat")) {
|
||||
log.warn(
|
||||
"Please browse to "
|
||||
+ (useSSL ? "https://" : "http://")
|
||||
+ "{}:{}{} to start using WebGoat...",
|
||||
event.getApplicationContext().getEnvironment().getProperty("webgoat.host"),
|
||||
port,
|
||||
contextPath);
|
||||
} else {
|
||||
log.warn(
|
||||
"Please browse to http://{}:{}{} to start using WebWolf...",
|
||||
event.getApplicationContext().getEnvironment().getProperty("webwolf.host"),
|
||||
port,
|
||||
contextPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user