couchbaselabs / CouchVersion

12 stars 6 forks source link

Poor choice of property names for Couchversion configuration #7

Open tallinn1960 opened 2 years ago

tallinn1960 commented 2 years ago

The choice of the properties to configure Couchversion does not fit well with spring configuration options. Spring has

already. Just the last property time fits the requirements of Couchversion. I suggest that the properties Couchversion is using shall be those listed above.

paulvi commented 2 years ago

well, disagree. Updating data structure can be / should be executing with higher priviledges than just adding/changing data. So different set of properties may be needed.

tallinn1960 commented 2 years ago

As the parameters have the password in common the current choice of parameter names does not support that setup scenario.

And for your setup scenario you need different parameters for username and password, but not for the couchbase connection string or the bucket name. The current choice of parameter names enforces repeating yourself.

I found a CouchVersion constructor that accepts a Cluster and a Bucket as parameters. The Cluster object can be autowired into the CouchVersion bean. This disables CouchVersion's username, password and connection-string parameters. I am fetching the bucket name from the spring parameter set by an @Value annotation. This will break if spring-data-couchbase changes parameter naming for the bucket so I would prefer CouchVersion to use Spring properties by default.

For your setup scenario one is in control and independent using @Value annotation or a custom property configuration class with custom parameter names, not relying on either CouchVersion's or Spring's parameter naming for username and password at all. But you still want both CouchVersion and Spring to use the same connection-string and bucket-name.