java-driver
java-driver copied to clipboard
Include support for comma seperated strings for basic.contact-points
The motivation for the PR is that in my project while using environment variables for the configuration via a Helm chart, I am unable to pass an array as an environment variable because it ends up as a string in the application configuration. Please let me know if I missed anything in the PR. I have already signed the CLA.
This has been sitting here for a while, can anyone take a look? @absurdfarce
I understand your point of view but the fact is that the approach you are suggesting is unusable with environment variables and configmaps from a HOCON point of view. Moreover, in our case, we are not using the library directly, but rather a Pekko library that uses this driver. So even if we could have one environment variable for multiple contact points, we cannot build a CqlSession and pass it along as an underlying session to the Pekko connector. Also, about the first review you posted, I don't think having ["a,b", "c"]
makes much sense because I doubt that users will have comma-separated items and other single items in the list at the same time.
Is there a reason you can't configure Pekko to use a custom session? It looks like that should be possible from this documentation: https://pekko.apache.org/docs/pekko-connectors/current/cassandra.html#custom-session-creation
You can create a custom CqlSessionProvider that sets contact points based on the environment: https://pekko.apache.org/api/pekko-connectors/snapshot/org/apache/pekko/stream/connectors/cassandra/CqlSessionProvider.html
The main drawbacks of the implementation in this PR are:
- Changing the parsing behavior of
basic.contact-points
could break existing client configurations - Allowing some list-typed configurations to support comma-separated strings when others don't is confusing for users