Skip to content

Instantly share code, notes, and snippets.

@meddulla
Created March 29, 2016 14:03
Show Gist options
  • Select an option

  • Save meddulla/bb56d2fb8dd5d2a01be3 to your computer and use it in GitHub Desktop.

Select an option

Save meddulla/bb56d2fb8dd5d2a01be3 to your computer and use it in GitHub Desktop.
phantom cassandra with user/pass combo
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