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
}
},
function (err) {
if (err)
console.log(err.message);
function getConsistencyLevel(consistency) {
let consistencyValue = consistency && _.get(models, `consistencies.${consistency}`) ? _.get(models, `consistencies.${consistency}`) : models.consistencies.one
return consistencyValue;
}
function getConsistencyLevel (consistency) {
let consistencyValue = consistency && _.get(expressCassandra, `consistencies.${consistency}`) ? _.get(expressCassandra, `consistencies.${consistency}`): expressCassandra.consistencies.one
return consistencyValue;
}