diff --git a/CHANGELOG.md b/CHANGELOG.md index 0801c54e..9f0cc2d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added multiple calendar icon support. - Added meta tags to support fullscreen mode on iOS (for server mode) - Added `ignoreOldItems` and `ignoreOlderThan` options to the News Feed module +- Added test for MM_PORT enviroment variable. - Added a configurable Week section to the clock module. ### Fixed @@ -68,6 +69,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. - Fixed missing animation on `this.show(speed)` when module is alone in a region. ## [2.1.0] - 2016-12-31 diff --git a/js/server.js b/js/server.js index c57b74f9..36ebf740 100644 --- a/js/server.js +++ b/js/server.js @@ -17,7 +17,14 @@ var helmet = require("helmet"); var Server = function(config, callback) { console.log("Starting server on 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); if (config.ipWhitelist instanceof Array && config.ipWhitelist.length == 0) { console.info("You're using a full whitelist configuration to allow for all IPs") diff --git a/tests/e2e/port_config.js b/tests/e2e/port_config.js index c0806e85..44c6b498 100644 --- a/tests/e2e/port_config.js +++ b/tests/e2e/port_config.js @@ -29,4 +29,23 @@ describe("port directive configuration", function () { }); }); }); + + describe("Set port 8100 on enviroment variable MM_PORT", function () { + before(function() { + process.env.MM_PORT = 8100; + // Set config sample for use in this test + process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js"; + }); + + after(function(){ + delete process.env.MM_PORT; + }); + it("should return 200", function (done) { + request.get("http://localhost:8100", function (err, res, body) { + expect(res.statusCode).to.equal(200); + done(); + }); + }); + }); + });