Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for /usr/local/etc/app.config #108

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 + '.conf'),
join(localEtc, name, 'config'),
join(localEtc, name + 'rc'),
join(localEtc, name + '.conf')].forEach(addConfigFile)
if (home)
[join(home, '.config', name, 'config'),
join(home, '.config', name),
Expand Down