Created
March 29, 2016 14:03
-
-
Save meddulla/bb56d2fb8dd5d2a01be3 to your computer and use it in GitHub Desktop.
phantom cassandra with user/pass combo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.cassandra.phantom.modeling.connector | |
| import java.net.InetAddress | |
| import com.typesafe.config.ConfigFactory | |
| import com.websudos.phantom.connectors.ContactPoints | |
| import scala.collection.JavaConversions._ | |
| object Connector { | |
| val config = ConfigFactory.load() | |
| val hosts = config.getStringList("cassandra.host") | |
| val inets = hosts.map(InetAddress.getByName) | |
| val keyspace: String = config.getString("cassandra.keyspace") | |
| val connector = ContactPoints(hosts).withClusterBuilder( | |
| _.withCredentials( | |
| config.getString("cassandra.username"), | |
| config.getString("cassandra.password") | |
| ) | |
| ).keySpace(keyspace) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment