From 1a217d028352c84f41eda7928597d2f89fda1d31 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Sat, 26 Sep 2020 14:15:45 -0400 Subject: [PATCH] feat: add --bind_ip_all flag Fix #42 --- index.js | 10 +++++++--- src/options.js | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) 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'