jLinux

Untitled

Dec 29th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. import * as _ from 'lodash';
  4. import * as Confidence from 'confidence';
  5. import Util from 'util';
  6.  
  7.  
  8. // Load the ./confidence.json file
  9. const confidenceJson = require('./confidence');
  10.  
  11. // Create a new Confidence Store
  12. const store = new Confidence.Store();
  13.  
  14. // Load the confidence.json content into our store
  15. store.load(confidenceJson);
  16.  
  17. // Get the connection data (On the first level of the confidence.json object level)
  18. const conn = store.get('/connections');
  19. console.log('conn', Util.inspect( conn ));
  20.  
  21. // Load the plugins config object, filtering for 'prod'
  22. const prodPlugins = store.get('/plugins', { env: 'prod' });
  23.  
  24. console.log(`# PROD PLUGINS ${_.repeat('=', 25)}`);
  25.  
  26. _.each( prodPlugins, ( conf, plugin ) => {
  27.     console.log('Plugin:', Util.inspect(plugin));
  28.     console.log('Conf:', Util.inspect(conf));
  29.     console.log( _.repeat('=', 40) );
  30. });
  31.  
  32. // Load the plugins config object again, but filter for 'dev' this time
  33. const devPlugins = store.get('/plugins', { env: 'dev' });
  34.  
  35. console.log(`# DEV PLUGINS ${_.repeat('=', 26)}`);
  36.  
  37. _.each( prodPlugins, ( conf, plugin ) => {
  38.     console.log('Plugin:', Util.inspect(plugin));
  39.     console.log('Conf:', Util.inspect(conf));
  40.     console.log( _.repeat('=', 40) );
  41. });
Advertisement
Add Comment
Please, Sign In to add comment