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

Support custom filepaths #71

Open
AndersDJohnson opened this issue Dec 29, 2015 · 3 comments
Open

Support custom filepaths #71

AndersDJohnson opened this issue Dec 29, 2015 · 3 comments

Comments

@AndersDJohnson
Copy link
Contributor

Maybe accept a filepaths array instead of the first argument, e.g. rc(['./my/custom/path'])? Then also expose default paths as rc.paths(appname) (as function not array, for immutability), so that user can prepend/append/inject custom paths in their preferred order, e.g. rc(['./custom/path'].concat(rc.paths(appname)))?

I might be able to submit a PR if you'd be interested.

@dominictarr
Copy link
Owner

As it stands, I'm not interested in a change like that. I am willing to listen to people who want to make changes to rc but I set a high bar for changes, and expect a solid justification of why that feature would be useful, in the context of a real application. This approach has meant that rc has remained focused and simple.

The goal of rc is to make it so that if you understand rc you never need to read custom configuration loading code.

So, tell me about your application and how it would use this feature and why it needs it. This is the important part, code is easy.

@AndersDJohnson
Copy link
Contributor Author

@dominictarr Fair enough, maybe it doesn't make sense for this project.

I might want to append a .json or .ini suffix to the file names for better support in other programs or tools.

I might want to load different configuration file names from disk - e.g. for different deployment environments like .appnamerc-dev vs. .appnamerc-prod. A similar effect could be accomplished with command-line arguments or environment variables, but this is a different use case.

@AndersDJohnson
Copy link
Contributor Author

Also, if I wanted to migrate a project to use rc, but needed backwards compatibility with previous config file names, e.g. for the node-gh project, which currently expects ~/.gh.json file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants