Hush.Provider behaviour (hush v1.3.0)

Copy Markdown View Source

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

child_spec()

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

Callbacks

fetch(key)

@callback fetch(key :: String.t()) ::
  {:ok, String.t()} | {:error, :not_found} | {:error, any()}

load(config)

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

Functions

fetch(provider, name)

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

Fetch a value from a provider

valid?(provider)

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

Is the provider a valid one?