Skogsrå v1.0.3 Skogsra.Settings View Source

Settings for Skogsra (only testing purposes).

Link to this section Summary

Functions

Changes Application for a custom module (only for testing purposes)

Changes Application for a custom module (only for testing purposes)

Changes System for a custom module (only for testing purposes)

Changes System for a custom module (only for testing purposes)

Link to this section Functions

Link to this function application_module(namespace \\ nil, type \\ :run) View Source
application_module(
  namespace :: atom(),
  type :: :run | :reload | :system | :config
) :: {:ok, term()} | {:error, term()}

Changes Application for a custom module (only for testing purposes).

A call to Elixir.Skogsra.application_module() will:

  1. If the OS environment variable is not nil, will return its casted value.
  2. If the OS environment variable is nil, then it will try to get the value in the configuration file.
  3. If the configuration file does not contain the value, will return the default value if it’s defined.
  4. If the default value is not defined and is not required, it will return nil, otherwise it will error.

A call to Elixir.Skogsra.application_module(namespace) will try to do the same as before, but using a namespace (atom()). This is useful for separating the different configurations values for the same variable.

The expected OS variable name can be obtained running the function Elixir.Skogsra.application_module)(namespace, :system) where namespace can be either nil or any namespace.

The expected configuration file can be obtained running the function Elixir.Skogsra.application_module)(namespace, :config) where namespace can be either nil or any namespace.

For testing purposes, the value can be reloaded at runtime with the function Elixir.Skogsra.application_module)(namespace, :reload)

Link to this function application_module!(namespace \\ nil) View Source
application_module!(namespace :: atom()) :: {:ok, term()} | {:error, term()}

Changes Application for a custom module (only for testing purposes).

Same as Elixir.Skogsra.application_module/0 but fails on error.

It can receive also a namespace when needed.

Link to this function system_module(namespace \\ nil, type \\ :run) View Source
system_module(namespace :: atom(), type :: :run | :reload | :system | :config) ::
  {:ok, term()} | {:error, term()}

Changes System for a custom module (only for testing purposes).

A call to Elixir.Skogsra.system_module() will:

  1. If the OS environment variable is not nil, will return its casted value.
  2. If the OS environment variable is nil, then it will try to get the value in the configuration file.
  3. If the configuration file does not contain the value, will return the default value if it’s defined.
  4. If the default value is not defined and is not required, it will return nil, otherwise it will error.

A call to Elixir.Skogsra.system_module(namespace) will try to do the same as before, but using a namespace (atom()). This is useful for separating the different configurations values for the same variable.

The expected OS variable name can be obtained running the function Elixir.Skogsra.system_module)(namespace, :system) where namespace can be either nil or any namespace.

The expected configuration file can be obtained running the function Elixir.Skogsra.system_module)(namespace, :config) where namespace can be either nil or any namespace.

For testing purposes, the value can be reloaded at runtime with the function Elixir.Skogsra.system_module)(namespace, :reload)

Link to this function system_module!(namespace \\ nil) View Source
system_module!(namespace :: atom()) :: {:ok, term()} | {:error, term()}

Changes System for a custom module (only for testing purposes).

Same as Elixir.Skogsra.system_module/0 but fails on error.

It can receive also a namespace when needed.