Rig.Config (Reactive Interaction Gateway v3.0.0-alpha.2) View Source

Rig module configuration that provides settings/0.

There are two ways to use this module

Specify a list of expected keys

defmodule Rig.MyExample do
  use Rig.Config, [:some_key, :other_key]
end

Rig.Config expects a config entry similar to this:

config :rig, Rig.MyExample,
  some_key: ...,
  other_key: ...

If one of the specified keys is not found, an error is thrown at compile time. Otherwise, Rig.MyExample gets a config/0 function that returns the configuration converted to a map. If there are other keys present, they'll be added to that map as well.

Specify :custom_validation instead

defmodule Rig.MyExample do
  use Rig.Config, :custom_validation

  defp validate_config!(config) do
    ...
  end
end

If you use :custom_validation, you should deal with the raw keyword list by implementing validate_config!/1 in the module.

Link to this section Summary

Link to this section Functions

Link to this function

check_and_update_https_config(config)

View Source

Specs

check_and_update_https_config(Keyword.t()) :: Keyword.t()
Link to this function

parse_json_env(path_or_encoded)

View Source

Specs

parse_json_env(String.t()) ::
  {:ok, any()}
  | {:error, %Rig.Config.SyntaxError{__exception__: term(), cause: term()}}
Link to this function

parse_socket_list(socket_list)

View Source

Specs

parse_socket_list([String.t(), ...]) :: [{String.t(), pos_integer()}, ...]