IBM / report-toolkit

A toolkit for consumers of Node.js diagnostic Reports
https://ibm.github.io/report-toolkit
Other
84 stars 10 forks source link

search for config in common places outside of home dir #83

Closed boneskull closed 4 years ago

boneskull commented 4 years ago

currently, we use cosmiconfig's default strategy, which is to walk "up" the tree for a config file. if cosmiconfig reaches the user's home directory, the search stops.

but if your cwd is outside of your home directory, it will search to the root fs, and stop if it can't find anything.

the strategy, IMO, should be:

  1. use the default search
  2. if no config file found, look in these (in order):
    1. $HOME/<file>
    2. $XDG_CONFIG_HOME/<file>
    3. $(npm get prefix)/etc/<file>
    4. /etc/<file>

This should (?) cover the usual suspects; others can use --rc to specify the path.

Need to tackle this as part of #66, because I don't want to document the current behavior, because it is dumb.