SamVerschueren / bragg-env

Environment middleware for bragg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bragg-env Build Status

Environment middleware for bragg.

Install

$ npm install --save bragg-env

Usage

const app = require('bragg')();
const environment = require('bragg-env');

app.use(environment());
app.use(ctx => {
    console.log(ctx.env);
    //=> 'staging'
});

You can use the NODE_ENV environment variable to overwrite the context environment.

process.env.NODE_ENV = 'test';

app.use(environment());
app.use(ctx => {
    console.log(ctx.env);
    //=> 'test'
});

API

environment([options])

Exposes the environment in the env property of the context object.

options

Type: object
Default: {$LATEST: 'development', default: 'production'}

An aws-lamba-env options object.

Related

License

MIT © Sam Verschueren

About

Environment middleware for bragg

License:MIT License


Languages

Language:JavaScript 100.0%