Git Product home page Git Product logo

blum's Introduction

Blum

Blum is a configuration document generator used to create Hapi manifest json files using Confidence. It creates a manifest.config.json file through an npm prestart script that 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 style criteria.

Build Status Coverage Status

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.

Criteria & Manifest files

Ensure that your criteria.js and manifest.js files both export a valid object that can be consumed by 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: {
		visionary: {
        	engines: {
            	jade: 'jade'
        	},
        	path: './views',
        	compileOptions: {
            	$filter: 'env',
            	production: {
                	pretty: false
            	},
            	$default: {
                	pretty: true
            	}
        	}
		}
	}
};

blum's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.