From 81bdf7d33e9c5d8eea90238101b765b86fa753d2 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Thu, 8 Jun 2017 21:40:17 +0300 Subject: [PATCH] Fix network name not being set when displayNetwork is false --- src/client.js | 2 +- src/helper.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 61f60ca9..f483d514 100644 --- a/src/client.js +++ b/src/client.js @@ -187,7 +187,7 @@ Client.prototype.connect = function(args) { args.hostname = args.hostname || (client.config && client.config.hostname) || client.hostname; var network = new Network({ - name: args.name || "", + name: (config.displayNetwork ? args.name : config.defaults.name) || "", host: args.host || "", port: parseInt(args.port, 10) || (args.tls ? 6697 : 6667), tls: !!args.tls, diff --git a/src/helper.js b/src/helper.js index 552b11ad..fb1982b7 100644 --- a/src/helper.js +++ b/src/helper.js @@ -7,6 +7,7 @@ var os = require("os"); var fs = require("fs"); var net = require("net"); var bcrypt = require("bcryptjs"); +const colors = require("colors/safe"); var Helper = { config: null, @@ -68,6 +69,12 @@ function setHome(homePath) { this.config = _.extend(this.config, userConfig); } + if (!this.config.displayNetwork && !this.config.lockNetwork) { + this.config.lockNetwork = true; + + log.warn(`${colors.bold("displayNetwork")} and ${colors.bold("lockNetwork")} are false, setting ${colors.bold("lockNetwork")} to true.`); + } + // TODO: Remove in future release if (this.config.debug === true) { log.warn("debug option is now an object, see defaults file for more information.");