Merge pull request #2065 from nasa/bind-to-loopback

Modified Express startup so that it only binds to loopback by default
This commit is contained in:
Pete Richards 2018-06-08 10:44:55 -07:00 committed by GitHub
commit e03ea25392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

5
app.js
View File

@ -19,6 +19,7 @@
// Defaults
options.port = options.port || options.p || 8080;
options.host = options.host || options.h || 'localhost'
options.directory = options.directory || options.D || '.';
['include', 'exclude', 'i', 'x'].forEach(function (opt) {
options[opt] = options[opt] || [];
@ -78,7 +79,7 @@
app.use(express['static'](options.directory));
// Finally, open the HTTP server and log the instance to the console
app.listen(options.port, function() {
console.log('Open MCT application running at localhost:' + options.port)
app.listen(options.port, options.host, function() {
console.log('Open MCT application running at %s:%s', options.host, options.port)
});
}());