https://github.com/chasevida/blum
Blum is a configuration document generator used to create manifest json files using Confidence.
https://github.com/chasevida/blum
Last synced: 4 months ago
JSON representation
Blum is a configuration document generator used to create manifest json files using Confidence.
- Host: GitHub
- URL: https://github.com/chasevida/blum
- Owner: chasevida
- Created: 2014-08-15T03:38:24.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-28T21:48:46.000Z (over 10 years ago)
- Last Synced: 2025-10-22T00:59:01.483Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 246 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blum
**Blum** is a configuration document generator used to create [Hapi](https://github.com/hapijs/hapi) manifest json files using [Confidence](https://github.com/hapijs/confidence). It creates a `manifest.config.json` file through an npm `prestart` script that [Rejoice](https://github.com/hapijs/rejoice) (the Hapi CLI) can consume on the command line with `rejoice -c manifest.config.json`.
This could be used for quick A/B testing at a high level or for simple things such as environment based server configuration.
While this was developed to be used in conjunction with a Hapi it can be used anywhere to auto generate a `configuration.json` based on the [Confidence](https://github.com/hapijs/confidence) style criteria.
[](https://www.npmjs.com/package/blum)
[](https://travis-ci.org/chasevida/blum)
[](https://coveralls.io/r/chasevida/blum?branch=master)
[](https://david-dm.org/chasevida/blum)
---
## Command Line
**Blum** takes the following flag options:
* `-c` - a *required* file path for `criteria.js` to be used by confidence.
* `-m` - a *required* file path for `manifest.js` to be edited by confidence and consumed by Hapi.
* `-f` - an *optional* output file name/path, defaults to `./manifest.config.json`
## Example
Use it straight from the command line:
$ blum -c criteria.js -m manifest.js -f manifest.config.json
Use it as a script in your package.json before calling Hapi:
"prestart": "blum -c config/criteria.js -m config/manifest.js -f config.json"
"start": "rejoice -c manifest.config.json"
## More examples
There is an example directory which contains a mock `package.json` file. Running `$ npm start` from within this folder will generate a manifest config file based on the details being passed from the `package.json` file. After it's created it will then run a Hapi server via the Rejoice CLI.
You can modify these settings as you like. If you add an environment variable before the call you will see a different manifest config file generated, this is the magic of [Confidence](https://github.com/hapijs/confidence).
## Criteria & Manifest files
Ensure that your `criteria.js` and `manifest.js` files both export a valid object that can be consumed by [Confidence](https://github.com/hapijs/confidence). Please check their docs for more details on this.
### Example Criteria.js
module.exports = {
env: process.env.ENVIRONMENT
};
### Example Manifest.js
The below example prettifies the jade html by default but when run in a production environment the html is minified.
module.exports = {
connections: [
{
port: 3000,
labels: [
'http'
]
}
],
server: {},
plugins: {
vision: {
engines: {
jade: 'jade'
},
path: './views',
compileOptions: {
$filter: 'env',
production: {
pretty: false
},
$default: {
pretty: true
}
}
}
}
};