smolnar82 commented on a change in pull request #65: KNOX-1774 - Introducing 
environment variables in gateway/knoxcli/ldap/knoxshell scripts for 
customization
URL: https://github.com/apache/knox/pull/65#discussion_r263786267
 
 

 ##########
 File path: 
gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
 ##########
 @@ -259,18 +256,30 @@ private String getGatewayHomeDir() {
 
   @Override
   public String getGatewayConfDir() {
-    String value = getVar( GATEWAY_CONF_HOME_VAR, getGatewayHomeDir() + 
File.separator + "conf"  );
-    return FilenameUtils.normalize(value);
+    // 1st try: using the old style environment/system property name
+    @SuppressWarnings("deprecation")
+    String configDir = System.getProperty(GATEWAY_CONF_HOME_VAR, 
System.getenv(GATEWAY_CONF_HOME_VAR));
+
+    // 2nd try: using the new style environment/system property name or use 
the default value (relative to the GATEWAY_HOME)
+    if (StringUtils.isBlank(configDir)) {
+      configDir = getVar(KNOX_GATEWAY_CONF_DIR_VAR, getGatewayHomeDir() + 
File.separator + "conf");
+    }
+    return FilenameUtils.normalize(configDir);
   }
 
   @Override
   public String getGatewayDataDir() {
-    String systemValue =
-        System.getProperty(GATEWAY_DATA_HOME_VAR, 
System.getenv(GATEWAY_DATA_HOME_VAR));
-    String dataDir;
-    if (systemValue != null) {
-      dataDir = systemValue;
-    } else {
+    // 1st try: using the old style environment/system property name
+    @SuppressWarnings("deprecation")
 
 Review comment:
   The old style env variable name (see GatwayConfig.GATEWAY_DATA_HOME)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to