From 3cfa1f42b2daa1c84d37c975b71676fdbcab2f75 Mon Sep 17 00:00:00 2001 From: "Stuart P. Bentley" Date: Tue, 9 Sep 2014 04:12:23 -0700 Subject: [PATCH] Use PORT and IP environment variables This makes Shout Heroku / Dokku / Plusku compatible. --- src/command-line/start.js | 46 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/command-line/start.js b/src/command-line/start.js index 83393bb0..edeee23e 100644 --- a/src/command-line/start.js +++ b/src/command-line/start.js @@ -1,23 +1,23 @@ -var config = require("../../config.json"); -var ClientManager = new require("../clientManager"); -var program = require("commander"); -var shout = require("../server"); - -program - .option("-h, --host ") - .option("-p, --port ") - .command("start") - .description("Start the server") - .action(function() { - var users = new ClientManager().getUsers(); - if (!config.public && !users.length) { - console.log(""); - console.log("No users found!"); - console.log("Create a new user with 'shout add '.") - console.log(""); - } else { - var host = program.host || config.host; - var port = program.port || config.port; - shout(port, host, config.public); - } - }); +var config = require("../../config.json"); +var ClientManager = new require("../clientManager"); +var program = require("commander"); +var shout = require("../server"); + +program + .option("-h, --host ") + .option("-p, --port ") + .command("start") + .description("Start the server") + .action(function() { + var users = new ClientManager().getUsers(); + if (!config.public && !users.length) { + console.log(""); + console.log("No users found!"); + console.log("Create a new user with 'shout add '.") + console.log(""); + } else { + var host = program.host || process.env.IP || config.host; + var port = program.port || process.env.PORT || config.port; + shout(port, host, config.public); + } + });