View Source Confex.Resolver (confex v3.5.1)

This module provides API to recursively resolve system tuples in a Map or Keyword structures.

Summary

Functions

Resolves all system tuples in a structure.

Same as resolve/1 but will raise ArgumentError if one of system tuples can not be resolved.

Functions

@spec resolve(config :: any()) :: {:ok, any()} | {:error, any()}

Resolves all system tuples in a structure.

Example

iex> Elixir.Confex.Resolver.resolve(nil)
{:ok, nil}

iex> :ok = System.delete_env("SOME_TEST_ENV")
...> {:error, {:unresolved, _message}} = Elixir.Confex.Resolver.resolve([test: {:system, "DOES_NOT_EXIST"}])
...> :ok = System.put_env("SOME_TEST_ENV", "some_value")
...> Elixir.Confex.Resolver.resolve([test: {:system, "SOME_TEST_ENV", "defaults"}])
{:ok, [test: "some_value"]}

iex> Elixir.Confex.Resolver.resolve([test: {:system, "DOES_NOT_EXIST", "defaults"}])
{:ok, [test: "defaults"]}
@spec resolve!(config :: any()) :: any() | no_return()

Same as resolve/1 but will raise ArgumentError if one of system tuples can not be resolved.