View Source OpenFeature (OpenFeature v0.1.1)

Module for OpenFeature Flag Evaluation API

Summary

Functions

Clears all stored providers.

Creates a client for a given domain.

Gets the global context.

Gets the provider for a given domain. If no domain is provided, the default domain will be used.

Sets the global context.

Sets the provider for a given domain.

Shuts down all providers.

Functions

Link to this function

clear_providers()

View Source (since 0.1.0)
@spec clear_providers() :: :ok

Clears all stored providers.

Link to this function

get_client(domain \\ "default")

View Source (since 0.1.0)
@spec get_client(domain :: OpenFeature.Types.domain()) :: OpenFeature.Client.t()

Creates a client for a given domain.

If no domain is provided, the default domain will be used. If no provider is set for the domain, the default provider will be used.

Link to this function

get_global_context()

View Source (since 0.1.0)
@spec get_global_context() :: OpenFeature.Types.context()

Gets the global context.

Link to this function

get_provider(domain \\ "default")

View Source (since 0.1.0)
@spec get_provider(domain :: OpenFeature.Types.domain()) :: OpenFeature.Provider.t()

Gets the provider for a given domain. If no domain is provided, the default domain will be used.

Link to this function

set_global_context(context)

View Source (since 0.1.0)
@spec set_global_context(context :: OpenFeature.Types.context()) :: :ok

Sets the global context.

Link to this function

set_provider(domain \\ "default", provider)

View Source (since 0.1.0)
@spec set_provider(
  domain :: OpenFeature.Types.domain(),
  provider :: OpenFeature.Provider.t()
) ::
  {:ok, OpenFeature.Provider.t()} | {:error, atom()}

Sets the provider for a given domain.

The provider is validated and is initialized with the global context. If a provider is already set for the domain, it will be replaced and shutdown. If the provider is the same as the one already set, it will not be replaced. If the provider is invalid or fails to be initialized, an error will be returned. If no domain is provided, the default domain will be used.

Link to this function

shutdown()

View Source (since 0.1.0)
@spec shutdown() :: :ok

Shuts down all providers.