0.0.4 • Published 10 years ago

duo-env v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

duo-env build status

Expose Node.js global process.env to compiled client-side code

Installation

$ npm install --save duo-env

Example

// file: app.js
var env = require('env').NODE_ENV

var uri = env === 'prod' ? 'api.foobar.io' : 'localhost:8000'

// ...
NODE_ENV=prod duo app.js > build/app.js --use duo-env
# Now "uri" in compiled app will equal 'api.foobar.io'

API

The following settings are available:

  • name – the literal module name that will be exposed, eg: what you want to require(NAME). Defaults to "env".
  • pick – expose only a subset of process.env. The exposed module is still a hash, but does not include the huge amount of things that process.env has even by default.

Currently these settings are only useable in a scripted duo context, but I want to make it possible to pass these on the CLI too: https://github.com/duojs/duo/issues/362

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago