Module: LaunchDarkly::Integrations::Consul

Defined in:
lib/ldclient-rb/integrations.rb,
lib/ldclient-rb/integrations/consul.rb

Overview

Integration with Consul.

Note that in order to use this integration, you must first install the gem diplomat.

Since:

  • 5.5.0

Class Method Summary collapse

Class Method Details

.default_prefixString

Default value for the prefix option for new_feature_store.

Returns:

  • (String)

    the default key prefix

Since:

  • 5.5.0



12
13
14
# File 'lib/ldclient-rb/integrations/consul.rb', line 12

def self.default_prefix
  'launchdarkly'
end

.new_feature_store(opts, &block) ⇒ LaunchDarkly::Interfaces::FeatureStore

Creates a Consul-backed persistent feature store.

To use this method, you must first install the gem diplomat. Then, put the object returned by this method into the feature_store property of your client configuration (Config).

Parameters:

  • opts (Hash)

    the configuration options

Options Hash (opts):

  • :consul_config (Hash)

    an instance of Diplomat::Configuration to replace the default Consul client configuration (note that this is exactly the same as modifying Diplomat.configuration)

  • :url (String)

    shortcut for setting the url property of the Consul client configuration

  • :prefix (String)

    namespace prefix to add to all keys used by LaunchDarkly

  • :logger (Logger)

    a Logger instance; defaults to Config.default_logger

  • :expiration (Integer) — default: 15

    expiration time for the in-memory cache, in seconds; 0 for no local caching

  • :capacity (Integer) — default: 1000

    maximum number of items in the cache

Returns:

Since:

  • 5.5.0



32
33
34
35
# File 'lib/ldclient-rb/integrations/consul.rb', line 32

def self.new_feature_store(opts, &block)
  core = LaunchDarkly::Impl::Integrations::Consul::ConsulFeatureStoreCore.new(opts)
  return LaunchDarkly::Integrations::Util::CachingStoreWrapper.new(core, opts)
end