Add IP config option
This commit is contained in:
parent
5a67343957
commit
0365ce1095
3 changed files with 9 additions and 4 deletions
|
@ -36,5 +36,9 @@ module.exports = {
|
|||
debug: {
|
||||
alias: 'd',
|
||||
describe: 'Force run the server in development mode'
|
||||
}
|
||||
},
|
||||
ip: {
|
||||
alias: 'i',
|
||||
describe: 'IP server runs on [default: 0.0.0.0]'
|
||||
},
|
||||
};
|
||||
|
|
|
@ -27,6 +27,7 @@ nconf.file(nconf.get('config') || './config.json');
|
|||
nconf.defaults({
|
||||
name: nconf.get('name') || 'spserver',
|
||||
NODE_ENV: 'development',
|
||||
ip: '0.0.0.0',
|
||||
production: {
|
||||
port: 80,
|
||||
bunyan: {
|
||||
|
|
|
@ -26,9 +26,9 @@ function _resolveFinalSettings(settings) {
|
|||
settings[env] = {};
|
||||
}
|
||||
|
||||
// For 'name', 'file', 'serve', and 'port', default to the global setting rather than an
|
||||
// For 'name', 'file', 'serve', 'ip', and 'port', default to the global setting rather than an
|
||||
// individual environment's setting, because it might have been set via command-line flags
|
||||
_(['name', 'file', 'serve', 'port']).forEach(function (field) {
|
||||
_(['name', 'file', 'serve', 'ip', 'port']).forEach(function (field) {
|
||||
finalSettings[field] = settings[field] || settings[env][field];
|
||||
});
|
||||
|
||||
|
@ -105,7 +105,7 @@ var spserver = function (settings) {
|
|||
}).resume();
|
||||
});
|
||||
|
||||
server.listen(finalSettings.port);
|
||||
server.listen(finalSettings.port, finalSettings.ip);
|
||||
|
||||
logger.info(
|
||||
'Started single-page server: ' + finalSettings.name +
|
||||
|
|
Loading…
Reference in a new issue