Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init() {
// Tell express-cassandra to use the models-directory, and
// use bind() to load the models using cassandra configurations.
var host = config.get('cassandra.host');
var port = config.get('cassandra.port');
var keyspace = config.get('cassandra.keyspace');
models.setDirectory(__dirname + '/models').bind({
clientOptions: {
contactPoints: [host],
protocolOptions: { port: port },
keyspace: keyspace,
queryOptions: { consistency: models.consistencies.one }
},
ormOptions: {
// If your keyspace doesn't exist it will be created automatically
// using the default replication strategy provided here.
defaultReplicationStrategy: {
class: 'SimpleStrategy',
replication_factor: 1
},
//migration: 'safe',
migration: 'alter',
createKeyspace: false
var _ = require('lodash');
var models = require('express-cassandra');
const envHelper = require('../environmentVariablesHelper');
const contactPoints = envHelper.PORTAL_CASSANDRA_URLS;
const keyspaceName = 'sunbird';
let isConnected = false;
const consistency = getConsistencyLevel(envHelper.PORTAL_CASSANDRA_CONSISTENCY_LEVEL);
models.setDirectory(__dirname + '/models').bind(
{
clientOptions: {
contactPoints: contactPoints,
keyspace: keyspaceName,
queryOptions: { consistency: consistency }
},
ormOptions: {
defaultReplicationStrategy: {
class: 'SimpleStrategy',
replication_factor: 1
},
migration: 'safe'
}
},
function (err) {
if (err) {