View Source Zexbox.Flags (Zexbox v0.7.0)
An Elixir wrapper around the LaunchDarkly Erlang client
To use this module you must have the LaunchDarkly Erlang client installed. To do so, add {:ldclient, "~> 2.0.0", hex: :launchdarkly_server_sdk} to your list of dependencies in mix.exs.
To start the client, call Zexbox.Flags.start/2 when starting your application with a map of config options and an optional tag:
def start(_type, _args) do
Zexbox.Flags.start(%{sdk_key: "sdk-key", private_attributes: [:email]})
...
end
To make sure that the client shuts down, you should call Zexbox.Flags.stop/1 when your application shuts down:
def stop(_type, _args) do
Zexbox.Flags.stop()
...
end
Summary
Functions
Starts the LaunchDarkly client with the given config and tag.
Starts the LaunchDarkly client with the given config.
Starts the LaunchDarkly client with the given config and tag.
Stops the ldclient with the default tag.
Stops the ldclient with the given tag.
Gets the variation of a flag for the given key, context, and default value.
Gets the variation of a flag for the given key, context, default value, and tag.
Functions
Starts the LaunchDarkly client with the given config and tag.
Examples
iex> Zexbox.Flags.start(%{sdk_key: "sdk-key"}, :my_tag)
:ok
iex> Zexbox.Flags.start(%{sdk_key: "sdk-key"}, :my_tag)
{:error, {:already_started, #PID<0.602.0>}}
Starts the LaunchDarkly client with the given config.
Starts the LaunchDarkly client with the given config and tag.
@spec stop() :: :ok
Stops the ldclient with the default tag.
@spec stop(atom()) :: :ok
Stops the ldclient with the given tag.
Gets the variation of a flag for the given key, context, and default value.
Gets the variation of a flag for the given key, context, default value, and tag.
Examples
iex> Zexbox.Flags.variation("my-flag", %{key: "user-key"}, false, :my_tag)
true
iex> Zexbox.Flags.variation("my-flag", %{key: "user-key"}, false, :my_tag)
{:error, {:not_found, "my-flag"}}