public SessionSettings(Config config)
{
if (config == null) throw new ArgumentNullException("config");
Builder = Cluster.Builder();
// Get IP and port configuration
int port = config.GetInt("port", 9042);
IPEndPoint[] contactPoints = ParseContactPoints(config.GetStringList("contact-points"), port);
Builder.AddContactPoints(contactPoints);
// Support user/pass authentication
if (config.HasPath("credentials"))
Builder.WithCredentials(config.GetString("credentials.username"), config.GetString("credentials.password"));
// Support SSL
if (config.GetBoolean("ssl"))
Builder.WithSSL();
// Support compression
string compressionTypeConfig = config.GetString("compression");
if (compressionTypeConfig != null)
{
var compressionType = (CompressionType) Enum.Parse(typeof (CompressionType), compressionTypeConfig, true);
Builder.WithCompression(compressionType);
}
}