app-conf
Usage
The following files are looked up and merged (the latest take
precedence):
- vendor:
config.*
in the application directory; - global:
/etc/my-application/config.*
; - user:
~/.config/my-application/config.*
; - local:
/.my-application.*
down to ./.my-application.*
in the current
working directory;
Note: the local config is relative to the current working directory and
only makes sense for CLIs.
var loadConfig = require("app-conf").load;
loadConfig("my-application", {
appDir: __dirname,
defaults: {},
entries: ["vendor", "global", "user", "local"],
ignoreUnknownFormats: false,
}).then(function(config) {
console.log(config);
});
Relative paths, string values starting by ./
or ../
, are automatically
resolved from the config file directory.
Paths relative to the home directory, string values starting by ~/
, are also
automatically resolved.
JSON format is supported natively but you may install the following
packages to have additional features:
Contributing
Contributions are very welcome, either on the documentation or on
the code.
You may:
- report any issue
you've encountered;
- fork and create a pull request.
License
ISC © Julien Fontanet