How to use the cassandra-driver.defaultOptions function in cassandra-driver

To help you get started, we’ve selected a few cassandra-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-connector-cassandra / lib / cassandra.js View on Github external
function generateOptions(settings) {
  var clientOptions = cassandra.defaultOptions();

  settings.hostname = (settings.hostname || settings.host || '127.0.0.1');
  settings.port = (settings.port || 9042);
  settings.database = (settings.keyspace || settings.database || settings.db || 'test');

  if (settings.contactPoints) {
    clientOptions.contactPoints = settings.contactPoints;
  } else {
    clientOptions.contactPoints = [
      settings.hostname,
    ];
  }
  
  clientOptions.protocolOptions.port = settings.port;
  clientOptions.keyspace = settings.database;
  clientOptions.sslOptions = settings.sslOptions;