Skip to content

Commit

Permalink
Merge pull request Kong#57 from marceldiass/mockbin-options
Browse files Browse the repository at this point in the history
Modify mockbin script to use env vars or custom npm config
  • Loading branch information
Ahmad Nassri authored Nov 20, 2016
2 parents cb362b5 + 2d9c487 commit 1b3966b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bin/mockbin
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ var app = require('../src')
var cmd = require('commander')
var pkg = require('../package')

var options = {
port: process.env.MOCKBIN_PORT || process.env.npm_package_config_port,
quiet: process.env.MOCKBIN_QUIET || process.env.npm_package_config_quiet,
redis: process.env.MOCKBIN_REDIS || process.env.npm_package_config_redis
}

cmd
.version(pkg.version)
.option('-p, --port <port>', 'HTTP server port', pkg.config.port)
.option('-q, --quiet', 'disable console logging', pkg.config.quiet)
.option('-r, --redis [dsn]', 'redis dsn', pkg.config.redis)
.option('-p, --port <port>', 'HTTP server port', options.port)
.option('-q, --quiet', 'disable console logging', options.quiet)
.option('-r, --redis [dsn]', 'redis dsn', options.redis)
.parse(process.argv)

app(cmd, function () {
Expand Down

0 comments on commit 1b3966b

Please sign in to comment.