package threesixty.persistence.cassandra

import com.websudos.phantom.connectors.{ContactPoints, KeySpace}
import threesixty.server.APIHandler

/**
  * Created by Stefan Cimander on 19.01.16.
  */
trait CassandraKeyspace {
    implicit val keySpace = KeySpace("threesixity")
}

object CassandraConnector extends CassandraKeyspace {
    // val hosts = Seq("137.250.170.136")
    // val hosts = Seq("localhost")
    val hosts = Seq(APIHandler.dbAddress)
    val dbKeyspace = APIHandler.dbKeyspace

    val keyspace = ContactPoints(hosts).keySpace(dbKeyspace)
}

package threesixty.persistence.cassandra

import com.websudos.phantom.connectors.{ContactPoints, KeySpace}

/**
  * Created by Stefan Cimander on 19.01.16.
  */
trait CassandraKeyspace {
    implicit val keySpace = KeySpace("threesixity")
}

object CassandraConnector extends CassandraKeyspace {
    val hosts = Seq("137.250.170.136")
    // val hosts = Seq("localhost")
    val keyspace = ContactPoints(hosts).keySpace("threesixty")
}

--- 
+++ 
@@ -1,6 +1,7 @@
 package threesixty.persistence.cassandra
 
 import com.websudos.phantom.connectors.{ContactPoints, KeySpace}
+import threesixty.server.APIHandler
 
 /**
   * Created by Stefan Cimander on 19.01.16.
@@ -10,7 +11,10 @@
 }
 
 object CassandraConnector extends CassandraKeyspace {
-    val hosts = Seq("137.250.170.136")
+    // val hosts = Seq("137.250.170.136")
     // val hosts = Seq("localhost")
-    val keyspace = ContactPoints(hosts).keySpace("threesixty")
+    val hosts = Seq(APIHandler.dbAddress)
+    val dbKeyspace = APIHandler.dbKeyspace
+
+    val keyspace = ContactPoints(hosts).keySpace(dbKeyspace)
 }
Read ip and keyspace from APIHandler

The ip and keyspace is now read from the APIHandler.

One alternative I've found is to load the information from the config
again but since Thomas Weber does not want the config to be loaded
multiple times this option was neglected.
