java-driver icon indicating copy to clipboard operation
java-driver copied to clipboard

Include support for comma seperated strings for basic.contact-points

Open utkuaydn opened this issue 1 year ago • 3 comments

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.

utkuaydn avatar Dec 04 '23 13:12 utkuaydn

This has been sitting here for a while, can anyone take a look? @absurdfarce

utkuaydn avatar Feb 16 '24 12:02 utkuaydn

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.

utkuaydn avatar Feb 23 '24 09:02 utkuaydn

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:

  1. Changing the parsing behavior of basic.contact-points could break existing client configurations
  2. Allowing some list-typed configurations to support comma-separated strings when others don't is confusing for users

aratno avatar Feb 27 '24 18:02 aratno