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

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

Closed
boneskull opened this issue Feb 11, 2020 · 0 comments
Closed

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

boneskull opened this issue Feb 11, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request package-fs Involving fs package

Comments

@boneskull
Copy link
Contributor

boneskull commented Feb 11, 2020

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.

@boneskull boneskull added enhancement New feature or request package-fs Involving fs package labels Feb 11, 2020
@boneskull boneskull self-assigned this Feb 11, 2020
boneskull added a commit that referenced this issue Feb 12, 2020
This will additionally search for an `.rtkrc.js` or `rtk.config.js` in
`$HOME`, `$(npm prefix)/etc`, and if on POSIX OS, XDG config dir(s) and
`/etc`, in that order.

I note that it's not particularly ergonomic to do this using
`cosmiconfig`'s API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request package-fs Involving fs package
Projects
None yet
Development

No branches or pull requests

1 participant