From cd0e6beac6ec48e0ca47c21dce992d3dddf13b27 Mon Sep 17 00:00:00 2001 From: Peter Droogmans Date: Tue, 15 Aug 2017 09:34:06 +0200 Subject: [PATCH 1/2] #12: Merge global and local config --- include/file-config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/file-config.js b/include/file-config.js index f1e55e2..5eb43e9 100644 --- a/include/file-config.js +++ b/include/file-config.js @@ -4,6 +4,7 @@ const config = require('./config'); const yaml = require('read-yaml'); const hash = require('hash-sum'); const Fs = require('./filesystem'); +const extend = require('util')._extend; /** * file config with local and global configuration files @@ -45,7 +46,9 @@ class fileConfig extends config { */ parseLocal() { try { - return yaml.sync(this.local, {}); + let global = yaml.sync(this.global, {}); + let local = yaml.sync(this.local, {}); + return extend(global, local); } catch (e) { console.log(`Error parsing configuration: "${this.local}"`); process.exit(1); From 68e038b6cf1a6cc5041cce4da0a88a57936dbfb0 Mon Sep 17 00:00:00 2001 From: Peter Droogmans Date: Tue, 15 Aug 2017 10:04:01 +0200 Subject: [PATCH 2/2] #12: Use method --- include/file-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/file-config.js b/include/file-config.js index 5eb43e9..524c018 100644 --- a/include/file-config.js +++ b/include/file-config.js @@ -46,7 +46,7 @@ class fileConfig extends config { */ parseLocal() { try { - let global = yaml.sync(this.global, {}); + let global = this.parseGlobal(); let local = yaml.sync(this.local, {}); return extend(global, local); } catch (e) {