diff --git a/index.js b/index.js index 019b9fa..2b0658c 100755 --- a/index.js +++ b/index.js @@ -109,13 +109,17 @@ function* run() { console.log(`Running '${mongod}'`, ports); const rs = new ReplSet(mongod, - ports.map(port => ({ - options: { + ports.map(port => { + const options = { port: port, dbpath: isWin ? `${dbPath}\\${port}` : `${dbPath}/${port}`, bind_ip: hostname + }; + if (commander.bind_ip_all) { + options.bind_ip_all = null; } - })), { replSet: 'rs' }); + return options; + }), { replSet: 'rs' }); if (commander.keep) { console.log(chalk.blue('Restarting replica set...')); diff --git a/src/options.js b/src/options.js index ff3286c..3a3c0b4 100644 --- a/src/options.js +++ b/src/options.js @@ -38,6 +38,10 @@ module.exports = Object.freeze([ option: '-l, --linux [string]', description: 'Override the default system linux. Only for linux version. `ubuntu1604` by default' }, + { + option: '-p, --bind_ip_all', + description: 'Allow connections from remote servers, not just from localhost.' + }, { option: '--help', description: 'Output help'