diff --git a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java index 69e59c4e..07a48ba4 100644 --- a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java +++ b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2018 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -63,6 +63,7 @@ public class WebSphereServerInfo implements IMetadataGenerator { private Bootstrap bootstrap; private final Map jvmOptionsFiles; private ServerEnv serverEnv; + private ServerEnv sharedServerEnv; private ServerEnv etcServerEnv; private final UserDirectory userDir; @@ -345,6 +346,17 @@ private boolean updateServerEnv() { serverEnv = null; } + File sharedServerEnvFile = getUserDirectory().getSharedPath().append(ExtendedConfigFile.SERVER_ENV_FILE).toFile(); + if (sharedServerEnvFile.exists()) { + if (sharedServerEnv == null || sharedServerEnv.hasChanged()) { + changed = true; + sharedServerEnv = new ServerEnv(sharedServerEnvFile, null); + } + } else if (sharedServerEnv != null) { + changed = true; + sharedServerEnv = null; + } + File etcServerEnvFile = runtime.getRuntimeLocation().append(ExtendedConfigFile.ETC_DIR).append(ExtendedConfigFile.SERVER_ENV_FILE).toFile(); if (etcServerEnvFile.exists()) { if (etcServerEnv == null || etcServerEnv.hasChanged()) { @@ -437,12 +449,28 @@ private void addServerVars(ConfigVars vars) { } } + String wlpOutputDir = System.getenv(Constants.WLP_OUTPUT_DIR); + if (wlpOutputDir != null && !wlpOutputDir.isEmpty()) { + vars.addResolved(Constants.WLP_OUTPUT_DIR, wlpOutputDir, null, null); + } + + String wlpUserDir = System.getenv(Constants.WLP_USER_DIR); + if (wlpUserDir != null && !wlpUserDir.isEmpty()) { + vars.addResolved(Constants.WLP_USER_DIR, wlpUserDir, null, null); + } + // Do the env vars from the /etc directory first - // since those from the server directory should override. + // since it is the lowest priority server.env file if (etcServerEnv != null) { etcServerEnv.getVariables(vars); } + // Followed by env vars from the /shared directory + if (sharedServerEnv != null) { + sharedServerEnv.getVariables(vars); + } + + // And finally the env vars from the config dir if (serverEnv != null) { serverEnv.getVariables(vars); }