Module: LaunchDarkly::Integrations::Consul

Defined in:
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



19
20
21
# File 'lib/ldclient-rb/integrations/consul.rb', line 19

def self.default_prefix
  'launchdarkly'
end

.new_feature_store(opts = {}) ⇒ 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) (defaults to: {})

    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



39
40
41
42
# File 'lib/ldclient-rb/integrations/consul.rb', line 39

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