8000 Add support for /usr/local/etc/app.config by tld · Pull Request #108 · dominictarr/rc · GitHub
[go: up one dir, main page]

Skip to content
8000
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
< 8000 summary data-target="diff-layout.tocMenuButton" data-ga-click="Pull Requests, open table of contents, type:semantic" data-view-component="true" class="Link--muted select-menu-button btn-link"> 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
0