all files / express-stormpath/lib/ client.js

100% Statements 12/12
100% Branches 0/0
100% Functions 2/2
100% Lines 12/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27          124×             63×     63× 63× 63×   63×  
'use strict';
 
var path = require('path');
var stormpath = require('stormpath');
var stormpathConfig = require('stormpath-config');
var configStrategy = stormpathConfig.strategy;
 
// Factory method to create a client using a configuration only.
// The configuration provided to this factory is the final configuration.
function ClientFactory(config) {
  return new stormpath.Client(
    new stormpathConfig.Loader([
      new configStrategy.ExtendConfigStrategy(config)
    ])
  );
}
 
module.exports = function (config) {
  var configLoader = stormpath.configLoader(config);
 
  // Load our integration config.
  configLoader.prepend(new configStrategy.LoadFileConfigStrategy(path.join(__dirname, '/config.yml'), true));
  configLoader.add(new configStrategy.EnrichClientFromRemoteConfigStrategy(ClientFactory));
  configLoader.add(new configStrategy.EnrichIntegrationFromRemoteConfigStrategy(ClientFactory));
 
  return new stormpath.Client(configLoader);
};