Skip to content

Commit

Permalink
feat: rename "bindAddress" option to "address"
Browse files Browse the repository at this point in the history
  • Loading branch information
capellini authored and gr2m committed Oct 4, 2016
1 parent e4571e4 commit 3d36a0a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/hapi-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function getHapiOptions (options) {
server: {},
connection: {
port: options.port,
address: options.bindAddress
address: options.address
}
}

Expand Down
2 changes: 1 addition & 1 deletion cli/hoodie-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = getHoodieDefaults

function getHoodieDefaults () {
return {
bindAddress: '127.0.0.1',
address: '127.0.0.1',
port: 8080,
data: '.hoodie',
public: 'public',
Expand Down
14 changes: 12 additions & 2 deletions cli/options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = getCliOptions

var log = require('npmlog')
var pick = require('lodash').pick
var rc = require('rc')
var yargs = require('yargs')
Expand Down Expand Up @@ -37,10 +38,14 @@ function getCliOptions (projectPath) {
default: defaults.port,
describe: 'Port-number to run the Hoodie App on'
},
address: {
type: 'string',
default: defaults.address,
describe: 'Address to which Hoodie binds'
},
bindAddress: {
type: 'string',
default: defaults.bindAddress,
describe: 'Address that Hoodie binds to'
describe: '[DEPRECATED] Address to which Hoodie binds (see --address)'
},
data: {
type: 'string',
Expand Down Expand Up @@ -88,6 +93,11 @@ function getCliOptions (projectPath) {
.wrap(Math.min(150, yargs.terminalWidth()))
.argv

if (options.bindAddress) {
log.warn('The use of --bindAddress is deprecated. Use the --address option instead.')
options.address = options.bindAddress
}

// rc & yargs are setting keys we are not interested in, like in-memory or _
// so we only pick the relevant ones based on they keys of the default options.
return pick(options, Object.keys(hoodieDefaults))
Expand Down

0 comments on commit 3d36a0a

Please sign in to comment.