config-property-stamp

1.1.0 • Public • Published

Build Status Coverage Status semantic-release

Config Property Stamp

A stamp (a composeable factory function) for use with stamp-it that creates an immutable deep property called config storing information from config with its' cascading configuration capabilities or an override with an arbitary configuration file you provide.

By itself you aren't gaining much, used in combination with other stamps you gain the composeable power to add the consistent config interface of the config module in an expected way.

For more information on using config

You can find detailed instructions on using config on the node-config wiki pages;

Usage

  • You need a configuration file, either an arbitrary file or in your Env config folder per config.

  • For loading up an arbitrary single config file:

// for a config file in the following path  {thepathWherethisCodeExecutes}/test/config.json
// with the following config
// {"item1": "test"}
 
const path = require('path');
// Factory Function.
const ConfigPropertyStamp = require('config-property-stamp');
const configPropertyStamp = ConfigPropertyStamp.create(path.join(__dirname, 'test', 'default.json'));
// configPropertyStamp is {item1: test}
  • For loading up config from default config module location:
// for a config file in the following path in your module config/default.json
// with the following config
// {"item1": "test2"}
 
const path = require('path');
const ConfigPropertyStamp = require('config-property-stamp');
// Looks for config in /config and cascades it all together.
const configPropertyStamp = ConfigPropertyStamp.create();
// configPropertyStamp is {item1: test2}

Readme

Keywords

Package Sidebar

Install

npm i config-property-stamp

Weekly Downloads

2

Version

1.1.0

License

MIT

Last publish

Collaborators

  • beautyhammer