Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- import * as _ from 'lodash';
- import * as Confidence from 'confidence';
- import Util from 'util';
- // Load the ./confidence.json file
- const confidenceJson = require('./confidence');
- // Create a new Confidence Store
- const store = new Confidence.Store();
- // Load the confidence.json content into our store
- store.load(confidenceJson);
- // Get the connection data (On the first level of the confidence.json object level)
- const conn = store.get('/connections');
- console.log('conn', Util.inspect( conn ));
- // Load the plugins config object, filtering for 'prod'
- const prodPlugins = store.get('/plugins', { env: 'prod' });
- console.log(`# PROD PLUGINS ${_.repeat('=', 25)}`);
- _.each( prodPlugins, ( conf, plugin ) => {
- console.log('Plugin:', Util.inspect(plugin));
- console.log('Conf:', Util.inspect(conf));
- console.log( _.repeat('=', 40) );
- });
- // Load the plugins config object again, but filter for 'dev' this time
- const devPlugins = store.get('/plugins', { env: 'dev' });
- console.log(`# DEV PLUGINS ${_.repeat('=', 26)}`);
- _.each( prodPlugins, ( conf, plugin ) => {
- console.log('Plugin:', Util.inspect(plugin));
- console.log('Conf:', Util.inspect(conf));
- console.log( _.repeat('=', 40) );
- });
Advertisement
Add Comment
Please, Sign In to add comment