From 9547a347c1e3cd36ef0dbeb5207dcc1c79943454 Mon Sep 17 00:00:00 2001 From: Terje Elde Date: Mon, 5 Mar 2018 09:47:13 +0100 Subject: [PATCH 1/4] Support /usr/local/etc and ".config" there. --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 65eb47a..3db7399 100755 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ var cc = require('./lib/utils') var join = require('path').join var deepExtend = require('deep-extend') var etc = '/etc' +var localEtc = '/usr/local/etc' var win = process.platform === "win32" var home = win ? process.env.USERPROFILE @@ -35,7 +36,11 @@ module.exports = function (name, defaults, argv, parse) { // which files do we look at? if (!win) [join(etc, name, 'config'), - join(etc, name + 'rc')].forEach(addConfigFile) + join(etc, name + 'rc'), + join(etc, name + '.config'), + join(localEtc, name, 'config'), + join(localEtc, name + 'rc') + join(localEtc, name + '.config')].forEach(addConfigFile) if (home) [join(home, '.config', name, 'config'), join(home, '.config', name), From 27f14c8886b16f4e569afc6ec6377d875dde4258 Mon Sep 17 00:00:00 2001 From: Terje Elde Date: Mon, 5 Mar 2018 09:48:46 +0100 Subject: [PATCH 2/4] Remember missing comma --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 3db7399..89ca29b 100755 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ module.exports = function (name, defaults, argv, parse) { join(etc, name + 'rc'), join(etc, name + '.config'), join(localEtc, name, 'config'), - join(localEtc, name + 'rc') + join(localEtc, name + 'rc'), join(localEtc, name + '.config')].forEach(addConfigFile) if (home) [join(home, '.config', name, 'config'), From 7471657b759f784f5618e75772cf17c6af8c8700 Mon Sep 17 00:00:00 2001 From: Terje Elde Date: Mon, 5 Mar 2018 09:51:06 +0100 Subject: [PATCH 3/4] Jeez, not enough coffee. I want .conf. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 89ca29b..c392847 100755 --- a/index.js +++ b/index.js @@ -37,10 +37,10 @@ module.exports = function (name, defaults, argv, parse) { if (!win) [join(etc, name, 'config'), join(etc, name + 'rc'), - join(etc, name + '.config'), + join(etc, name + '.conf'), join(localEtc, name, 'config'), join(localEtc, name + 'rc'), - join(localEtc, name + '.config')].forEach(addConfigFile) + join(localEtc, name + '.conf')].forEach(addConfigFile) if (home) [join(home, '.config', name, 'config'), join(home, '.config', name), From 03f810d14cce7f64890355f148c3b5e465941481 Mon Sep 17 00:00:00 2001 From: Terje Elde Date: Mon, 5 Mar 2018 09:59:08 +0100 Subject: [PATCH 4/4] Update README to be in sync with supporting /usr/local/etc and .config. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7f4b85e..e06798f 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ Given your application name (`appname`), rc will look in all the obvious places * `$HOME/.config/${appname}/config` * `/etc/${appname}rc` * `/etc/${appname}/config` + * `/etc/${appname}.config` + * `/usr/local/etc/${appname}rc` + * `/usr/local/etc/${appname}/config` + * `/usr/local/etc/${appname}.config` * the defaults object you passed in. All configuration sources that were found will be flattened into one object,