Couchbase multiple buckets in .NET app.config
.net, app-config, couchbase
Solution
According to John's suggestion, I used such configuration:
<configuration>
<configSections>
<sectionGroup name="couchbase">
<section name="bucket-1" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
...
<section name="bucket-N" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
</sectionGroup>
</configSections>
...
<couchbase>
<bucket-1>
<servers bucket="bucket-1" bucketPassword="pass">
<add uri="http://10.0.0.1:8091/pools/default"/>
<add uri="http://10.0.0.2:8091/pools/default"/>
</servers>
</bucket-1>
</couchbase>
...
</configuration>
Then in app code you can get bucket's client:
var client = new CouchbaseClient((CouchbaseClientSection)ConfigurationManager.GetSection("couchbase/bucket-1"));
It would be nice, if developers of .Net couchbase library implement reading such configuration.
Problem
Couchbase .Net manual says that I can configure my client in this way: ``` <couchbase><servers bucket="default" bucketPassword=""> <add uri="http://192.168.0.2:8091/pools/default"/> <add uri="http://192.168.0.3:8091/pools/default"/> </servers></couchbase> ``` Is there any way to define sevral buckets in app.config and then switch between them in my app?