LOKE application configuration management

Downloads in past


003.0.05 years ago5 years agoMinified + gzip package size for @loke/config in KB


LOKE Config
Convention based configuration module using YAML for Node apps.


The configuration exposed will be created from the following paths (settings in paths higher on the list will override those lower on the list):
  • {apppath}/config.yml
  • {apppath}/config/config.yml
  • /private/etc/{appname}/config.yml
  • /etc/{appname}/config.yml
  • {apppath}/config/defaults.yml

However, if the process has a --config [filename] argument, then that file will be used instead.
The defaults.yml file is required, and all configuration keys must have a value listed in the defaults.yml.


Config files are defined using YAML. See http://yaml.org/

How to Use

Example defaults.yml:
  hostname: www.myapp.com
  port: 80

var config = require('loke-config').create('myapp');

var hostname = config.get('server.hostname');
var port = config.get('server.port');

console.log(hostname); // www.myapp.com
console.log(port); // 80

Environment Variables

You can also override variables using environment variables. Specify them in upper case, and replace . with __ (double underscore).
SERVER__HOSTNAME=www.mynewapp.com npm start