I have the current application.conf...
datastax-java-driver {
basic.contact-points = ["192.168.23.1:9042"]
basic {
load-balancing-policy {
local-datacenter = datacenter1
}
}
advanced.metrics {
factory.class = MicrometerMetricsFactory
}
advanced.request.warn-if-set-keyspace = false
advanced.auth-provider {
class = PlainTextAuthProvider
username = cassandra
password = cassandra
}
profiles {
slow {
basic.request.timeout = 10 seconds
}
}
}
I also have a env var with the IP address DOCKER_IP. I tried
basic.contact-points = ["${DOCKER_IP}:9042"]
But it didn't work and instead defaulted to the local computer.
@clunven suggested that it is possible and here is an example where it is done.
TL;DR
set it as
contact-points = [${CASSANDRA_CONTACT_POINTS}]and the env variable is set asCASSANDRA_CONTACT_POINTS: "cassandra:9042"as an example.