View Source Hush.Provider behaviour (hush v1.2.0)

Hush relies on providers to resolve values that the consumer requests.

You can read here on how to write your own provider.

Summary

Functions

Fetch a value from a provider

Is the provider a valid one?

Types

@type child_spec() :: Supervisor.child_spec()

Callbacks

@callback fetch(key :: String.t()) ::
  {:ok, String.t()} | {:error, :not_found} | {:error, any()}
@callback load(config :: Keyword.t()) :: :ok | {:ok, [child_spec()]} | {:error, any()}

Functions

@spec fetch(module(), String.t()) ::
  {:ok, String.t() | nil} | {:error, :required} | {:error, any()}

Fetch a value from a provider

@spec valid?(module()) :: :ok | {:error, String.t()}

Is the provider a valid one?