From 08f197f91232dd056dcc4416bb32aaee6abe21a3 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 4 Jul 2016 23:15:30 +0300 Subject: [PATCH] Only load config if it exists --- src/helper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helper.js b/src/helper.js index cac3ce78..c2a69c83 100644 --- a/src/helper.js +++ b/src/helper.js @@ -1,6 +1,7 @@ var _ = require("lodash"); var path = require("path"); var os = require("os"); +var fs = require("fs"); var Helper = { config: null, @@ -25,8 +26,10 @@ function setHome(homePath) { this.USERS_PATH = path.join(this.HOME, "users"); // Reload config from new home location - var userConfig = require(this.CONFIG_PATH); - this.config = _.extend(this.config, userConfig); + if (fs.existsSync(this.CONFIG_PATH)) { + var userConfig = require(this.CONFIG_PATH); + this.config = _.extend(this.config, userConfig); + } } function getUserConfigPath(name) {