Bolin Zhu
06/12/2023, 11:08 AMdagster.EnvVar
to load an environment variable while constructing a resource. I am doing something like this:
configured_cassandra_resource = Cassandra(
clusters=os.getenv("CASSANDRA_CLUSTERS").split(),
port=<http://EnvVar.int|EnvVar.int>("CASSANDRA_PORT"),
user=EnvVar("CASSANDRA_USER"),
password=EnvVar("CASSANDRA_PASSWORD")
)
Is there a way to use EnvVar and load the environment variable CASSANDRA_CLUSTERS
as an array?
EnvVar("CASSANDRA_CLUSTERS").split()
does not work as it returns ["CASSANDRA_CLUSTERS"]
as the value (see screenshot)
Alternatively, is there a more elegant way to supply an array of string to Cassandra.clusters
?Qwame
06/12/2023, 12:40 PM.strip("][").split(",")
Tim Castillo
06/12/2023, 4:40 PMEnvVar
to take a string of comma-separated values and then split them within your custom resource at runtime?Bolin Zhu
06/13/2023, 2:09 AM