MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / createBootstrapConnectionWithOpts

Function createBootstrapConnectionWithOpts

rest/main.go:437–473  ·  view source on GitHub ↗
(ctx context.Context, opts bootstrapConnectionOpts)

Source from the content-addressed store, hash-verified

435}
436
437func createBootstrapConnectionWithOpts(ctx context.Context, opts bootstrapConnectionOpts) (base.BootstrapConnection, error) {
438 if base.ServerIsWalrus(opts.server) {
439 cluster := base.NewRosmarCluster(opts.server)
440 return cluster, nil
441 }
442
443 var connStr string
444 var err error
445 if opts.isServerless {
446 connStr, err = base.GetGoCBConnStringWithDefaults(opts.server, base.DefaultServerlessGoCBConnStringParams())
447 } else {
448 connStr, err = base.GetGoCBConnStringWithDefaults(opts.server, base.DefaultGoCBConnStringParams())
449 }
450 if err != nil {
451 return nil, err
452 }
453 cluster, err := base.NewCouchbaseCluster(ctx,
454 base.CouchbaseClusterSpec{
455 Server: connStr,
456 Username: opts.username,
457 Password: opts.password,
458 X509Certpath: opts.x509CertPath,
459 X509Keypath: opts.x509KeyPath,
460 CACertpath: opts.caCertPath,
461 TLSSkipVerify: base.ValDefault(opts.tlsSkipVerify, false),
462 },
463 opts.isServerless,
464 opts.bucketCredentials,
465 opts.useXattrConfig,
466 opts.bucketConnectionMode)
467 if err != nil {
468 base.InfofCtx(ctx, base.KeyConfig, "Couldn't create couchbase cluster instance: %v", err)
469 return nil, err
470 }
471
472 return cluster, nil
473}
474
475// parseFlags handles the parsing of legacy and persistent config flags.
476func parseFlags(ctx context.Context, args []string) (flagStartupConfig *StartupConfig, fs *flag.FlagSet, disablePersistentConfig *bool, err error) {

Calls 8

ServerIsWalrusFunction · 0.92
NewRosmarClusterFunction · 0.92
NewCouchbaseClusterFunction · 0.92
ValDefaultFunction · 0.92
InfofCtxFunction · 0.92

Tested by

no test coverage detected