Lamina.Provider.fetch_config

You're seeing just the callback fetch_config, go back to Lamina.Provider module for more information.
Link to this callback

fetch_config(config_key, state)

Specs

fetch_config(config_key, state()) ::
  {:ok, value, lifetime(), state()} | {:ok, state()} | {:error, reason, state()}
when config_key: atom(), value: any(), reason: any()

Called by Lamina when it wants to retrieve a configuration value.

Arguments

  • config_key - the name of the configuration value to be returned.
  • state - the current provider state.

Return values

There are three possible return values:

  1. A successful retrieval of a configuration value, including a lifetime indicator.
  2. Inability to supply a configuration value, which is not an error.
  3. An error.

Lifetime indicators

When returning a configuration value, Lamina expects a provider to provide additional information about how long it can expect the value to be valid for.

Valid lifetime indicators are:

  1. :static indicating that the value can never change. This is most likely for a default value, or one which may have been compiled in.
  2. :volatile indicating that the value can potentially change every time it is read.
  3. A tuple containing a combination of a positive integer and a time unit. Units are those specified by the System.time_unit typespec. For example {60, :second} or {3, :microsecond}. Useful for providers such as Vault which allow values to be leased for a specific period of time.