confab-features
Feature gates for confab. Declare a list of features that can be toggled on and off:
var confab = ;var features = ; var config = ;
Run the app with gates set by either a previous transformation or environment overrides:
$ CONFIG_FEATURES_NEW_UI=true \ node app.js
Then, inside the app, retrieve the feature configurations from a processed
confab config
:
if configfeaturesnew_ui ;else ;
The full list of configured features is available by invoking config.features
directly:
config;
API
confab-features
exports:
: Map<String Boolean>
Note that items
may contain both string keys
and simple object with a key
and (optional) description of the feature:
[
'new_ui',
{ key: 'new_campaign', description: 'A switch to flip' }
]
opts
Name | Type | Description |
---|---|---|
configKey |
String |
The config key for 'features' and environment variables (default: 'features' ) |
validate |
Boolean |
Throw on undeclared or invalid feature settings (default: true ) |
Quis configiet ipsos configes?
Development
Clone this repository:
$ git clone git@github.com:rjz/confab-features.git
...and copy, fork, customize, and whatever you need to do.
Testing
Lint and run test suite:
$ npm test
License
MIT