CFCouchbase SDK
  • Introduction
  • What's New With 2.2.0
  • What's New With 2.0.0
  • About This Book
  • Authors
  • Overview
  • Installation
    • ColdBox Module
    • Traditional Apps
  • Configuration
    • Settings
    • Structure
    • Summary
  • Usage
    • Storing Documents
    • Storage Durability
    • Retrieving Documents
    • Data Serialization
    • Components
      • Auto Inflation
      • Manual Inflation
      • Custom Serialization
      • Binary
    • Custom Transformers
    • Executing Queries
      • View Queries
      • n1ql Queries
      • Query Options
      • Filter Closures
      • Transform Closures
      • Return Types
    • Managing Views
    • Working With Futures
  • Help & Support
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF

Configuration

PreviousTraditional AppsNextSettings

Last updated 4 years ago

Was this helpful?

The most portable method for configuring the client is to use a CFC to place your config settings in much like our other libraries such as and allow. To do this simply create a plain CFC with a public method called configure(). Inside of that method, put your config settings into the variables scope of the component. The configure() method does not need to return any value. It will be automatically invoked by the SDK prior to the config settings being extracted from the CFC.

component {

    function configure() {
        servers = ['http://cache1:8091','http://cache2:8091'];
        bucketName = 'myBucket';
        password = 'myPass';
    }

}

To use the config CFC, simply pass it into the CouchbaseClient's constructor.

// You can pass an instance
couchbase = new cfcouchbase.CouchbaseClient( new path.to.config() );

// You can also pass a path to the CFC
couchbase = new cfcouchbase.CouchbaseClient( 'path.to.config' );
WireBox
CacheBox