npm.io
0.11.7 • Published 9 years ago

app-spec

Licence
ISC
Version
0.11.7
Deps
1
Vulns
0
Weekly
0

app-spec

Get application configuration from spec of required environment variables.

Usage

We define environment dependencies and defaults via a spec file:

module.exports = {
    description: 'Redis-based caching proxy for Google Maps API queries.',
    required: {
        redisHost: {
            description: 'the Redis host',
            default: 'localhost'
        },
        redisPort: {
            description: 'the Redis port',
            default: 6379
        }
    }
}

The application index.js passes the spec definition and main (entry-point) function to the application archetype.

require('redis-koa-app-rpf')(require('./spec'), require('./main'));

The application archetype uses this library to parse the config from process.env according to the spec and to invoke the main function.

Used by


https://twitter.com/@evanxsummers