connie
Configuration loader using a pluggable storage engine and custom interpolation language.
connie uses connie-lang to interpret configuration objects after they are read from the storage.
connie works really well with app-context. Check out the simple integration using app-context-connie.
.json
and .txt
files will be loaded based on their extension.
Installation
$ npm install --save connie$ yarn add connie
Usage
Using a single storage engine
;
Built-in storage engines
file
Loads config from a file.
connie'file', 'path/to/file.json'connie'file', 'path/to/file.txt'
dir
Loads config from a directory of files.
connie'dir', 'path/to/dir'
File names will become keys in your config. For example, if you had a directory
config
with the following files:
facebook.txt
hello world!
twitter.json
then the resulting config would be
http
Loads config from a JSON endpoint using a simple GET request.
connie'http', 'http://your-configuration-server.com/production.json'
http options
You can also pass an options object instead of just a URL.
url
(required) - URL of HTTP endpoint
headers
- an object containing extra headers to add to the request
method
- the method to use (defaults to GET)
query
- an object to be stringified into the querystring
auth
- an auth string for basic authentication
timeout
- number of milliseconds before the request will timeout
var configurer = ;
app-context through app-context-connie
Usage withmodule { this ;};