11package org .couchbase .quickstart .configs ;
22
3+ import com .couchbase .client .core .deps .io .netty .handler .ssl .util .InsecureTrustManagerFactory ;
4+ import com .couchbase .client .core .env .IoConfig ;
5+ import com .couchbase .client .core .env .SecurityConfig ;
36import com .couchbase .client .core .error .BucketExistsException ;
47import com .couchbase .client .core .msg .kv .DurabilityLevel ;
58import com .couchbase .client .java .Bucket ;
69import com .couchbase .client .java .Cluster ;
10+ import com .couchbase .client .java .ClusterOptions ;
11+ import com .couchbase .client .java .env .ClusterEnvironment ;
712import com .couchbase .client .java .manager .bucket .BucketSettings ;
813import com .couchbase .client .java .manager .bucket .BucketType ;
914import org .springframework .beans .factory .annotation .Autowired ;
@@ -16,6 +21,24 @@ public class CouchbaseConfig {
1621 @ Autowired
1722 private DBProperties dbProp ;
1823
24+ /**
25+ * NOTE: To connect with Couchbase CAPELLA please use the commented method bellow as it requires TLS
26+ */
27+ /* @Bean
28+ public Cluster getCouchbaseCluster(){
29+ ClusterEnvironment env = ClusterEnvironment.builder()
30+ .securityConfig(SecurityConfig.enableTls(true)
31+ .trustManagerFactory(InsecureTrustManagerFactory.INSTANCE))
32+ .ioConfig(IoConfig.enableDnsSrv(true))
33+ .build();
34+ return Cluster.connect(dbProp.getHostName(),
35+ ClusterOptions.clusterOptions(dbProp.getUsername(), dbProp.getPassword()).environment(env));
36+ }
37+ */
38+
39+ /**
40+ * NOTE: To connect with Couchbase locally use the methode bellow
41+ */
1942 @ Bean
2043 public Cluster getCouchbaseCluster (){
2144 return Cluster .connect (dbProp .getHostName (), dbProp .getUsername (), dbProp .getPassword ());
0 commit comments