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
@spec clear_providers() :: :ok
Clears all stored providers.
@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.
@spec get_global_context() :: OpenFeature.Types.context()
Gets the global context.
@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.
@spec set_global_context(context :: OpenFeature.Types.context()) :: :ok
Sets the global context.
@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.
@spec shutdown() :: :ok
Shuts down all providers.