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:
- A successful retrieval of a configuration value, including a lifetime indicator.
- Inability to supply a configuration value, which is not an error.
- 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:
:static
indicating that the value can never change. This is most likely for a default value, or one which may have been compiled in.:volatile
indicating that the value can potentially change every time it is read.- 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.