From c282bb2fe1e79a585c31c4d80d0174949b8d6400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Fri, 10 Mar 2017 18:20:11 -0300 Subject: [PATCH] Fix if MM_PORT enviroment variable is set --- CHANGELOG.md | 1 + js/server.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1138da27..bdc8783b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Module currentWeather: check if temperature received from api is defined. - Fix an issue with module hidden status changing to `true` although lock string prevented showing it - Fix newsfeed module bug (removeStartTags) +- Fix when is set MM_PORT enviroment variable. ## [2.1.0] - 2016-12-31 diff --git a/js/server.js b/js/server.js index 901e0350..53d00235 100644 --- a/js/server.js +++ b/js/server.js @@ -15,9 +15,15 @@ var fs = require("fs"); var helmet = require("helmet"); var Server = function(config, callback) { - console.log("Starting server op port " + config.port + " ... "); - server.listen(config.port, config.address ? config.address : null); + var port = config.port; + if (process.env.MM_PORT) { + port = process.env.MM_PORT; + } + + console.log("Starting server op port " + port + " ... "); + + server.listen(port, config.address ? config.address : null); app.use(function(req, res, next) { var result = ipfilter(config.ipWhitelist, {mode: "allow", log: false})(req, res, function(err) {