How to use the cassandra-driver.auth.PlainTextAuthProvider 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 tierratelematics / prettygoat / scripts / cassandra / CassandraClient.ts View on Github external
constructor(@inject("ICassandraConfig") private config: ICassandraConfig) {
        let authProvider: auth.AuthProvider;
        if (config.username && config.password) {
            authProvider = new auth.PlainTextAuthProvider(config.username, config.password);
        }
        this.client = new Client(assign({
            contactPoints: config.hosts,
            keyspace: config.keyspace,
            authProvider: authProvider
        }, config.driverOptions || {}));

        this.wrappedExecute = Observable.fromNodeCallback(this.client.execute, this.client);
        this.wrappedEachRow = Observable.fromNodeCallback(this.client.eachRow, this.client);
    }