Packages

ConfigCat SDK for Elixir. Feature Flags created by developers for developers with ❤️. ConfigCat lets you manage feature flags across frontend, backend, mobile, and desktop apps without (re)deploying code. % rollouts, user targeting, segmentation. Feature toggle SDKs for all main languages.

Current section

Files

Jump to
configcat lib config_cat null_data_source.ex
Raw

lib/config_cat/null_data_source.ex

defmodule ConfigCat.NullDataSource do
@moduledoc """
Don't provide any local flag overrides.
Used to avoid `is_nil` checks in the rest of the code.
See `ConfigCat.OverrideDataSource` for more details.
"""
use TypedStruct
alias ConfigCat.OverrideDataSource
typedstruct do
# No fields
end
@doc """
Create a `ConfigCat.OverrideDataSource` that does nothing.
"""
@spec new :: t
def new do
%__MODULE__{}
end
defimpl OverrideDataSource do
alias ConfigCat.Config
alias ConfigCat.NullDataSource
@spec behaviour(NullDataSource.t()) :: OverrideDataSource.behaviour()
def behaviour(_data_source), do: :local_over_remote
@spec overrides(NullDataSource.t()) :: Config.t()
def overrides(_data_source), do: Config.new()
end
end