changeset 166:10df2fd85ca1

Fall back to system property if THERMOSTAT_GATEWAY_HOME not set in environment If the environment variable THERMOSTAT_GATEWAY_HOME is not set, this patch checks to see if it's set as a Java system property. This is useful as it allows another level of configuration - the command line should always take precedence over environment. This behaviour is consistent with the old Thermostat. Reviewed-by: sgehwolf Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-June/023498.html
author Simon Tooke <stooke@redhat.com>
date Wed, 31 May 2017 18:48:25 -0400
parents 8ff65314fb0d
children 8822a33e3823
files server/src/main/java/com/redhat/thermostat/gateway/server/Start.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/server/src/main/java/com/redhat/thermostat/gateway/server/Start.java	Thu Jun 01 08:52:08 2017 -0400
+++ b/server/src/main/java/com/redhat/thermostat/gateway/server/Start.java	Wed May 31 18:48:25 2017 -0400
@@ -48,7 +48,7 @@
 public class Start {
 
     public void run() {
-        String gatewayHome = System.getenv(GlobalConstants.GATEWAY_HOME_ENV);
+        String gatewayHome = System.getProperty(GlobalConstants.GATEWAY_HOME_ENV, System.getenv(GlobalConstants.GATEWAY_HOME_ENV));
         if (gatewayHome == null) {
             throw new RuntimeException("Environment variable THERMOSTAT_GATEWAY_HOME not defined!");
         }