changeset 221:362ef36b1cef

Allow overriding /gatewayUrl response in express server Reviewed-by: jkang Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-September/025149.html
author Andrew Azores <aazores@redhat.com>
date Thu, 21 Sep 2017 17:08:50 -0400
parents b686b8d24638
children 0e10eacbeeb7
files server.js
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/server.js	Thu Sep 21 16:26:15 2017 -0400
+++ b/server.js	Thu Sep 21 17:08:50 2017 -0400
@@ -32,6 +32,7 @@
 
 var port = process.env.PORT || 8080;
 var host = process.env.HOST || '0.0.0.0';
+var gatewayUrl = process.env.GATEWAY_URL || 'http://localhost:8888/';
 
 var app = express();
 app.use(cors());
@@ -48,5 +49,5 @@
 
 app.get('/gatewayurl', function (req, res, next) {
   res.setHeader('Content-Type', 'application/json');
-  res.send(JSON.stringify({ gatewayUrl: 'http://localhost:8888/' }));
+  res.send(JSON.stringify({ gatewayUrl: gatewayUrl }));
 });