/**
* Build a configuration by adding the expected defaults
*/
public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) {
CompositeConfiguration config = new CompositeConfiguration();
config.addConfiguration(spec.getConfiguration());
try {
config.addConfiguration(
new PropertiesConfiguration("whirr-elasticsearch-default.properties"));
} catch (ConfigurationException e) {
LOG.error("Configuration error", e); // this should never happen
}
if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) {
addDefaultsForEC2(spec, config);
} else {
addDefaultsForUnicast(cluster, config);
}
if (!config.containsKey("es.cluster.name")) {
config.addProperty("es.cluster.name", spec.getClusterName());
}
return config;
}