OpenFeature (openfeature_elixir v0.1.0)

OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.

  ldProviderConfig =
    OpenFeature.Providers.LaunchdarklyProvider.new()
    |> OpenFeature.Providers.LaunchdarklyProvider.set_sdk_key(System.get_env("LD_SDK_KEY"))

  OpenFeature.set_provider(
    OpenFeature.Providers.LaunchdarklyProvider,
    ldProviderConfig
  )

  globalContext =
    OpenFeature.Context.new_targeted_context("user-dov", %{
      kind: "user-other",
      name: "Dov"
    })

  OpenFeature.set_global_context(globalContext)

  # Create a client using the default provider
  client = OpenFeature.Client.new()

  value = OpenFeature.Client.get_boolean_value(client, "test-flag-for-demo", false

Summary

Functions

Get the global context for all clients.

Get the global default provider for all clients which don't specify their own.

Set the global context for all clients.

Set the global default provider for all clients which don't specify their own.

Functions

Link to this function

get_global_context()

Get the global context for all clients.

Get the global default provider for all clients which don't specify their own.

Link to this function

set_global_context(context)

Set the global context for all clients.

Link to this function

set_provider(provider, args)

Set the global default provider for all clients which don't specify their own.