View Source Yggdrasil.Config (Yggdrasil v6.0.2)

This module defines the available config variables for Yggdrasil.

Link to this section Summary

Functions

Preloads all variables in a namespace if supplied.

Yggdrasil publisher options. These options are for :poolboy.

Yggdrasil publisher options. These options are for :poolboy.

Puts the value to Yggdrasil.Config.module_registry/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.publisher_options/0. Optionally, receives the namespace.

Reloads the value for Yggdrasil.Config.module_registry/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.publisher_options/0. Optionally, receives the namespace for the variable.

Creates a template for OS environment variables given a filename. Additionally, it can receive a list of options

Validates that all required variables are present. Returns :ok if they are, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

Link to this section Functions

Link to this function

module_registry(namespace \\ nil)

View Source

Specs

module_registry(Skogsra.Env.namespace()) :: {:ok, atom()} | {:error, binary()}

Module registry.

iex> Yggdrasil.Config.module_registry!()
:"$yggdrasil_registry"

Calling Yggdrasil.Config.module_registry() will ensure the following:

  • Binding order: [:config]
  • OS environment variable: ""
  • Type: :atom
  • Default: :"$yggdrasil_registry"
  • Required: false
  • Cached: true
Link to this function

module_registry!(namespace \\ nil)

View Source

Specs

module_registry!(Skogsra.Env.namespace()) :: atom() | no_return()

Module registry.

iex> Yggdrasil.Config.module_registry!()
:"$yggdrasil_registry"

Bang version of Yggdrasil.Config.module_registry/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

preload(namespace \\ nil)

View Source

Specs

preload(Skogsra.Env.namespace()) :: :ok

Preloads all variables in a namespace if supplied.

Link to this function

publisher_options(namespace \\ nil)

View Source

Specs

publisher_options(Skogsra.Env.namespace()) :: {:ok, any()} | {:error, binary()}

Yggdrasil publisher options. These options are for :poolboy.

iex> Yggdrasil.Config.publisher_options!()
[size: 1, max_overflow: 5]

Calling Yggdrasil.Config.publisher_options() will ensure the following:

  • Binding order: [:config]
  • OS environment variable: ""
  • Type: :any
  • Default: [size: 1, max_overflow: 5]
  • Required: false
  • Cached: true
Link to this function

publisher_options!(namespace \\ nil)

View Source

Specs

publisher_options!(Skogsra.Env.namespace()) :: any() | no_return()

Yggdrasil publisher options. These options are for :poolboy.

iex> Yggdrasil.Config.publisher_options!()
[size: 1, max_overflow: 5]

Bang version of Yggdrasil.Config.publisher_options/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

put_module_registry(value, namespace \\ nil)

View Source

Specs

put_module_registry(atom(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.module_registry/0. Optionally, receives the namespace.

Link to this function

put_publisher_options(value, namespace \\ nil)

View Source

Specs

put_publisher_options(any(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.publisher_options/0. Optionally, receives the namespace.

Link to this function

reload_module_registry(namespace \\ nil)

View Source

Specs

reload_module_registry(Skogsra.Env.namespace()) ::
  {:ok, atom()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.module_registry/0. Optionally, receives the namespace for the variable.

Link to this function

reload_publisher_options(namespace \\ nil)

View Source

Specs

reload_publisher_options(Skogsra.Env.namespace()) ::
  {:ok, any()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.publisher_options/0. Optionally, receives the namespace for the variable.

Link to this function

template(filename, options \\ [])

View Source

Specs

template(
  Path.t(),
  keyword()
) :: :ok | {:error, File.posix()}

Creates a template for OS environment variables given a filename. Additionally, it can receive a list of options:

  • type: What kind of file it will generate (:elixir, :unix, :windows).
  • namespace: Namespace for the variables.
Link to this function

validate(namespace \\ nil)

View Source

Specs

validate(Skogsra.Env.namespace()) :: :ok | {:error, [binary()]}

Validates that all required variables are present. Returns :ok if they are, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

It is possible to provide a namespace as argument (defaults to nil).

Link to this function

validate!(namespace \\ nil)

View Source

Specs

validate!(Skogsra.Env.namespace()) :: :ok | no_return()

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

It is possible to provide a namespace as argument (defaults to nil).