コード例 #1
0
        /// <summary>
        /// initialize the couchbase configuration values (for use when processing actions)
        /// </summary>
        public void Initialize()
        {
            ParseEnvironmentVariables();
            VerifyEnvironmentVariables();

            ClientConfiguration config = new ClientConfiguration();

            config.BucketConfigs.Clear();
            config.Servers = ServerUris;

            // add all the buckets to the config
            Buckets.ForEach(bucket => config.BucketConfigs.Add(bucket, new BucketConfiguration {
                BucketName = bucket, Username = Username, Password = Password
            }));

            // set up cluster
            Cluster = new Cluster(config);

            PasswordAuthenticator authenticator = new PasswordAuthenticator(Username, Password);

            Cluster.Authenticate(authenticator);

            ClusterHelper.Initialize(Cluster.Configuration);
        }