index.js
function(options) {
  options    = options || {};

  var config = konfig({ path: options.configPath || process.cwd() + '/config' });

  // Default options
  options.server                = options.server || { port: process.env.PORT };
  options.debug                 = options.debug || false;
  options.discoverable          = options.discoverable || false;
  options.monitorsPath          = options.monitorsPath || 'monitors';
  options.controllersPath       = options.controllersPath || 'controllers';
  options.callerPath            = options.callerPath || path.dirname(caller(2));
  options.serviceName           = pkgInfo.name;
  options.serviceBasePath       = 'services';
  options.zookeeper             = { connectionString: 'localhost:2181', retry: { count: 5 } };
  options.partialResponseQuery  = options.partialResponseQuery || 'fields';
  options.correlationHeaderName = options.correlationHeaderName || 'X-CorrelationID';
  options.validatorOptions      = options.validatorOptions || null;

  // Feature Flags
  options.enableBodyParsing     = options.enableBodyParsing || true;
  options.enableEtag            = options.enableEtag || false;
  options.enableRequestTracing  = options.enableRequestTracing || false;

  // Return now if we have no config
  if (!config.app) {
    return options;
  }

  // Overlay config file options
  options.server              = config.app.server || { port: process.env.PORT };
  options.serviceName         = config.app.microservice.server.name || pkgInfo.name;
  options.serviceBasePath     = config.app.microservice.basePath || 'services';
  options.networkInterfaces   = (config.app.microservice.server.registrationNetworkInterfacePriority) ? config.app.microservice.server.registrationNetworkInterfacePriority : null;
  options.serviceDependencies = (config.app.microservice.server.dependencies) ? config.app.microservice.server.dependencies.split(',') : null;
  options.zookeeper           = config.app.zookeeper || { connectionString: 'localhost:2181', retry: { count: 5 } };

  return options;
}
function(options) {
  options    = options || {};

  var config = konfig({ path: options.configPath || process.cwd() + '/config' });

  // Default options
  options.server                = options.server || { port: process.env.PORT };
  options.debug                 = options.debug || false;
  options.discoverable          = options.discoverable || false;
  options.monitorsPath          = options.monitorsPath || 'monitors';
  options.controllersPath       = options.controllersPath || 'controllers';
  options.callerPath            = options.callerPath || path.dirname(caller(2));
  options.serviceName           = pkgInfo.name;
  options.serviceBasePath       = 'services';
  options.zookeeper             = { connectionString: 'localhost:2181', retry: { count: 5 } };
  options.partialResponseQuery  = options.partialResponseQuery || 'fields';
  options.correlationHeaderName = options.correlationHeaderName || 'X-CorrelationID';
  options.validatorOptions      = options.validatorOptions || null;

  // Feature Flags
  options.enableBodyParsing     = options.enableBodyParsing || true;
  options.enableEtag            = options.enableEtag || false;
  options.enableRequestTracing  = options.enableRequestTracing || false;

  // Return now if we have no config
  if (!config.app) {
    return options;
  }

  // Overlay config file options
  options.server              = config.app.server || { port: process.env.PORT };
  options.serviceName         = config.app.microservice.server.name || pkgInfo.name;
  options.serviceBasePath     = config.app.microservice.basePath || 'services';
  options.networkInterfaces   = (config.app.microservice.server.registrationNetworkInterfacePriority) ? config.app.microservice.server.registrationNetworkInterfacePriority : null;
  options.serviceDependencies = (config.app.microservice.server.dependencies) ? config.app.microservice.server.dependencies.split(',') : null;
  options.zookeeper           = config.app.zookeeper || { connectionString: 'localhost:2181', retry: { count: 5 } };

  return options;
}
function ( options ) { options = options || { } ; var config = konfig ( { path : options . configPath || process . cwd ( ) + '/config' } ) ; // Default options options . server = options . server || { port : process . env . PORT } ; options . debug = options . debug || false ; options . discoverable = options . discoverable || false ; options . monitorsPath = options . monitorsPath || 'monitors' ; options . controllersPath = options . controllersPath || 'controllers' ; options . callerPath = options . callerPath || path . dirname ( caller ( 2 ) ) ; options . serviceName = pkgInfo . name ; options . serviceBasePath = 'services' ; options . zookeeper = { connectionString : 'localhost:2181' , retry : { count : 5 } } ; options . partialResponseQuery = options . partialResponseQuery || 'fields' ; options . correlationHeaderName = options . correlationHeaderName || 'X-CorrelationID' ; options . validatorOptions = options . validatorOptions || null ; // Feature Flags options . enableBodyParsing = options . enableBodyParsing || true ; options . enableEtag = options . enableEtag || false ; options . enableRequestTracing = options . enableRequestTracing || false ; // Return now if we have no config if ( ! config . app ) { return options ; } // Overlay config file options options . server = config . app . server || { port : process . env . PORT } ; options . serviceName = config . app . microservice . server . name || pkgInfo . name ; options . serviceBasePath = config . app . microservice . basePath || 'services' ; options . networkInterfaces = ( config . app . microservice . server . registrationNetworkInterfacePriority ) ? config . app . microservice . server . registrationNetworkInterfacePriority : null ; options . serviceDependencies = ( config . app . microservice . server . dependencies ) ? config . app . microservice . server . dependencies . split ( ',' ) : null ; options . zookeeper = config . app . zookeeper || { connectionString : 'localhost:2181' , retry : { count : 5 } } ; return options ; }
Construct an options instance.
Construct an options instance .