Skip to content

Commit

Permalink
add localhost to the list of default hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed May 18, 2011
1 parent 95f45c7 commit af85b1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion server/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Command.toString = function() {
Command.options = {
'host': {
'description': 'Hostnames allowed for requests. Wildcards are allowed.',
'default': [ require('os').hostname() ]
'default': [ 'localhost', require('os').hostname() ]
}
};
8 changes: 4 additions & 4 deletions test/cli-coverage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var assert = require('assert');
var os = require('os');
var exec = require('child_process').exec;

var hostnameDescription = 'Hostnames allowed for requests. Wildcards are allowed. (Default: ["' + os.hostname() + '","other","*.third"])';
var hostnameDescription = 'Hostnames allowed for requests. Wildcards are allowed. (Default: ["localhost","' + os.hostname() + '","other","*.third"])';

// Remove all hidden properties from an object.
function makePlain(json) {
Expand Down Expand Up @@ -91,7 +91,7 @@ exports['test foo --config=test/fixture/config.json'] = function(beforeExit) {
assert.deepEqual(makePlain(require('bones').plugin.config), {
lorem: 'ipsum',
dolor: __dirname + '/fixture/commands',
host: [ os.hostname(), 'other', '*.third' ],
host: [ 'localhost', os.hostname(), 'other', '*.third' ],
adminParty: true,
unknownOption: 42
});
Expand All @@ -112,7 +112,7 @@ exports['test foo --dolor=pain'] = function(beforeExit) {
assert.deepEqual(makePlain(require('bones').plugin.config), {
lorem: 'ipsum',
dolor: 'pain',
host: [ os.hostname(), 'other', '*.third' ],
host: [ 'localhost', os.hostname(), 'other', '*.third' ],
adminParty: false
});
assert.equal(output, 'successfully started!');
Expand All @@ -131,7 +131,7 @@ exports['test foo --config=test/fixture/config.json --show-config'] = function(b
assert.deepEqual(makePlain(require('bones').plugin.config), {
lorem: 'ipsum',
dolor: 'pain',
host: [ os.hostname(), 'other', '*.third' ],
host: [ 'localhost', os.hostname(), 'other', '*.third' ],
adminParty: true,
unknownOption: 42
});
Expand Down
7 changes: 4 additions & 3 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var assert = require('assert');
var os = require('os');
var exec = require('child_process').exec;

var hostnameDescription = 'Hostnames allowed for requests. Wildcards are allowed. (Default: ["' + os.hostname() + '","other","*.third"])';
var hostnameDescription = 'Hostnames allowed for requests. Wildcards are allowed. (Default: ["localhost","' + os.hostname() + '","other","*.third"])';

exports['test --help'] = function() {
exec('node test/fixture --help', function(err, stdout, stderr) {
Expand Down Expand Up @@ -52,7 +52,7 @@ exports['test foo --config=test/fixture/config.json'] = function() {
unknownOption: 42,
lorem: "ipsum",
dolor: __dirname + '/fixture/commands',
host: [ os.hostname(), 'other', '*.third' ]
host: [ 'localhost', os.hostname(), 'other', '*.third' ]
});
assert.equal(stderr, 'Note: Unknown option "unknownOption" in config file.\n');
});
Expand All @@ -65,7 +65,7 @@ exports['test foo --dolor=pain'] = function() {
adminParty: false,
lorem: "ipsum",
dolor: 'pain',
host: [ os.hostname(), 'other', '*.third' ]
host: [ 'localhost', os.hostname(), 'other', '*.third' ]
});
assert.equal(stderr, '');
});
Expand All @@ -85,6 +85,7 @@ exports['test foo --config=test/fixture/config.json --show-config'] = function()
' "lorem": "ipsum",\n' +
' "dolor": "' + __dirname + '/fixture/commands",\n' +
' "host": [\n' +
' "localhost",\n' +
' "' + os.hostname() + '",\n' +
' "other",\n' +
' "*.third"\n' +
Expand Down

0 comments on commit af85b1d

Please sign in to comment.