Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 892 Bytes

File metadata and controls

42 lines (32 loc) · 892 Bytes

ExLaunchDarkly

A quick Elixir wrapper around the official LaunchDarkly Erlang library

Installation

def deps do
  [
    {:ex_launch_darkly, github: "pixelunion/elixir-launchdarkly", tag: "v0.4.3"}
  ]
end

Usage

Start your connection to LaunchDarkly on Application start.

ExLaunchDarkly.App.start(Application.fetch_env!(:your_application, :launchdarkly_api_key))

Retrieve a variation.

ExLaunchDarkly.variation("Some-Flag", ExLaunchDarkly.User.new("SomeUser"), false)

Testing

You can configure LaunchDarkly to only use a test data source:

ExLaunchDarkly.App.start(
  "fake-key",
  :default,
  %{
    datasource: :testdata,
    send_events: false,
    feature_store: :ldclient_storage_map
  }
)