Skip to content

sytac/platform-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

platform-config

Description

Fetch and validate platform configurations more easily

Installation

$ npm install --save platform-config

If you'd like to try these examples, please run gulp prepare-examples first

// ./examples/easy/index.js

'use strict';

var path = require('path');
var platformConfig = require('platform-config');

var platforms = platformConfig({
  targets: path.join(__dirname, 'targets')
});

var current = platforms.current();
console.log(current);

In targets are the following files:

// ./examples/easy/targets/development.js

'use strict';

var config = {
  description: 'BY THE POWER OF DEVELOPMENT'
};

module.exports = config;
// ./examples/easy/targets/production.js

'use strict';

var config = {
  description: 'BY THE POWER OF PRODUCTION'
};

module.exports = config;
$ node examples/easy
{ description: 'BY THE POWER OF DEVELOPMENT' }
$ node examples/easy --NODE_ENV production
{ description: 'BY THE POWER OF PRODUCTION' }
$ export NODE_ENV=production
$ node examples/easy
{ description: 'BY THE POWER OF PRODUCTION' }

You can test and unset NODE_ENV like so:

$ echo $NODE_ENV
production
$ unset NODE_ENV
$ echo NODE_ENV

Running tests

$ gulp test

Test reports are written to ./reports.

Contributing

  • Do pull requests.
  • Make sure there's tests and meaningful coverage.
  • Respect ./eslintrc.
  • Issues should go in issues.

About

Load and validate node environments more easily

Resources

License

Stars

Watchers

Forks

Packages

No packages published