Yggdrasil v5.0.0 Yggdrasil.Settings View Source

This module defines the available settings for Yggdrasil.

Link to this section Summary

Functions

Yggdrasil publisher options. These options are for :poolboy.

Yggdrasil publisher options. These options are for :poolboy.

Pub-sub adapter to use for channels.

Pub-sub adapter to use for channels.

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

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

Puts the value to Yggdrasil.Settings.pubsub_adapter/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Settings.pubsub_name/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Settings.pubsub_options/0. Optionally, receives the namespace.

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

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

Reloads the value for Yggdrasil.Settings.pubsub_adapter/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Settings.pubsub_name/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Settings.pubsub_options/0. Optionally, receives the namespace for the variable.

Link to this section Functions

Link to this function

module_registry(namespace \\ nil) View Source
module_registry(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Module registry.

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

A call to Yggdrasil.Settings.module_registry():

  1. When the OS environment variable is not nil, then it'll return its casted value.
  2. When the OS environment variable is nil, then it'll try to get the value from the configuration file.
  3. When the configuration file does not contain the variable, then it'll return the default value if it's defined.
  4. When the default value is not defined and it's not required, it'll return nil, otherwise it'll return an error.

A call to Yggdrasil.Settings.module_registry(namespace) will try to do the same as before, but with a namespace (atom()). This is useful for spliting different configurations values for the same variable e.g. different environments.

The OS environment variables expected are:

  • When no namespace is specified, then it'll be $YGGDRASIL_MODULE_REGISTRY.
  • When a namespace is specified e.g. My.Custom.Namespace, then it'll be $MY_CUSTOM_NAMESPACE_YGGDRASIL_MODULE_REGISTRY.

The expected application configuration would be as follows:

  • Without namespace:
  config :yggdrasil,
  module_registry: :atom() # Defaults to :"$yggdrasil_registry"
  • With namespace e.g. My.Custom.Namespace:
  config :yggdrasil, My.Custom.Namespace,
  module_registry: :atom() # Defaults to :"$yggdrasil_registry"
Link to this function

module_registry!(namespace \\ nil) View Source
module_registry!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Module registry.

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

Bang version of Yggdrasil.Settings.module_registry/0 (fails on error).

Link to this function

publisher_options(namespace \\ nil) View Source
publisher_options(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Yggdrasil publisher options. These options are for :poolboy.

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

A call to Yggdrasil.Settings.publisher_options():

  1. When the OS environment variable is not nil, then it'll return its casted value.
  2. When the OS environment variable is nil, then it'll try to get the value from the configuration file.
  3. When the configuration file does not contain the variable, then it'll return the default value if it's defined.
  4. When the default value is not defined and it's not required, it'll return nil, otherwise it'll return an error.

A call to Yggdrasil.Settings.publisher_options(namespace) will try to do the same as before, but with a namespace (atom()). This is useful for spliting different configurations values for the same variable e.g. different environments.

The OS environment variables expected are:

  • When no namespace is specified, then it'll be $YGGDRASIL_PUBLISHER_OPTIONS.
  • When a namespace is specified e.g. My.Custom.Namespace, then it'll be $MY_CUSTOM_NAMESPACE_YGGDRASIL_PUBLISHER_OPTIONS.

The expected application configuration would be as follows:

  • Without namespace:
  config :yggdrasil,
  publisher_options: :binary() # Defaults to [size: 1, max_overflow: 5]
  • With namespace e.g. My.Custom.Namespace:
  config :yggdrasil, My.Custom.Namespace,
  publisher_options: :binary() # Defaults to [size: 1, max_overflow: 5]
Link to this function

publisher_options!(namespace \\ nil) View Source
publisher_options!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Yggdrasil publisher options. These options are for :poolboy.

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

Bang version of Yggdrasil.Settings.publisher_options/0 (fails on error).

Link to this function

pubsub_adapter(namespace \\ nil) View Source
pubsub_adapter(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Pub-sub adapter to use for channels.

iex> Yggdrasil.Settings.pubsub_adapter!()
Phoenix.PubSub.PG2

A call to Yggdrasil.Settings.pubsub_adapter():

  1. When the OS environment variable is not nil, then it'll return its casted value.
  2. When the OS environment variable is nil, then it'll try to get the value from the configuration file.
  3. When the configuration file does not contain the variable, then it'll return the default value if it's defined.
  4. When the default value is not defined and it's not required, it'll return nil, otherwise it'll return an error.

A call to Yggdrasil.Settings.pubsub_adapter(namespace) will try to do the same as before, but with a namespace (atom()). This is useful for spliting different configurations values for the same variable e.g. different environments.

The OS environment variables expected are:

  • When no namespace is specified, then it'll be $YGGDRASIL_PUBSUB_ADAPTER.
  • When a namespace is specified e.g. My.Custom.Namespace, then it'll be $MY_CUSTOM_NAMESPACE_YGGDRASIL_PUBSUB_ADAPTER.

The expected application configuration would be as follows:

  • Without namespace:
  config :yggdrasil,
  pubsub_adapter: :atom() # Defaults to Phoenix.PubSub.PG2
  • With namespace e.g. My.Custom.Namespace:
  config :yggdrasil, My.Custom.Namespace,
  pubsub_adapter: :atom() # Defaults to Phoenix.PubSub.PG2
Link to this function

pubsub_adapter!(namespace \\ nil) View Source
pubsub_adapter!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Pub-sub adapter to use for channels.

iex> Yggdrasil.Settings.pubsub_adapter!()
Phoenix.PubSub.PG2

Bang version of Yggdrasil.Settings.pubsub_adapter/0 (fails on error).

Link to this function

pubsub_name(namespace \\ nil) View Source
pubsub_name(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Pub-sub name.

iex> Yggdrasil.Settings.pubsub_name!()
Yggdrasil.PubSub

A call to Yggdrasil.Settings.pubsub_name():

  1. When the OS environment variable is not nil, then it'll return its casted value.
  2. When the OS environment variable is nil, then it'll try to get the value from the configuration file.
  3. When the configuration file does not contain the variable, then it'll return the default value if it's defined.
  4. When the default value is not defined and it's not required, it'll return nil, otherwise it'll return an error.

A call to Yggdrasil.Settings.pubsub_name(namespace) will try to do the same as before, but with a namespace (atom()). This is useful for spliting different configurations values for the same variable e.g. different environments.

The OS environment variables expected are:

  • When no namespace is specified, then it'll be $YGGDRASIL_PUBSUB_NAME.
  • When a namespace is specified e.g. My.Custom.Namespace, then it'll be $MY_CUSTOM_NAMESPACE_YGGDRASIL_PUBSUB_NAME.

The expected application configuration would be as follows:

  • Without namespace:
  config :yggdrasil,
  pubsub_name: :atom() # Defaults to Yggdrasil.PubSub
  • With namespace e.g. My.Custom.Namespace:
  config :yggdrasil, My.Custom.Namespace,
  pubsub_name: :atom() # Defaults to Yggdrasil.PubSub
Link to this function

pubsub_name!(namespace \\ nil) View Source
pubsub_name!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Pub-sub name.

iex> Yggdrasil.Settings.pubsub_name!()
Yggdrasil.PubSub

Bang version of Yggdrasil.Settings.pubsub_name/0 (fails on error).

Link to this function

pubsub_options(namespace \\ nil) View Source
pubsub_options(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Pub-sub options.

iex> Yggdrasil.Settings.pubsub_options!()
[pool_size: 1]

A call to Yggdrasil.Settings.pubsub_options():

  1. When the OS environment variable is not nil, then it'll return its casted value.
  2. When the OS environment variable is nil, then it'll try to get the value from the configuration file.
  3. When the configuration file does not contain the variable, then it'll return the default value if it's defined.
  4. When the default value is not defined and it's not required, it'll return nil, otherwise it'll return an error.

A call to Yggdrasil.Settings.pubsub_options(namespace) will try to do the same as before, but with a namespace (atom()). This is useful for spliting different configurations values for the same variable e.g. different environments.

The OS environment variables expected are:

  • When no namespace is specified, then it'll be $YGGDRASIL_PUBSUB_OPTIONS.
  • When a namespace is specified e.g. My.Custom.Namespace, then it'll be $MY_CUSTOM_NAMESPACE_YGGDRASIL_PUBSUB_OPTIONS.

The expected application configuration would be as follows:

  • Without namespace:
  config :yggdrasil,
  pubsub_options: :binary() # Defaults to [pool_size: 1]
  • With namespace e.g. My.Custom.Namespace:
  config :yggdrasil, My.Custom.Namespace,
  pubsub_options: :binary() # Defaults to [pool_size: 1]
Link to this function

pubsub_options!(namespace \\ nil) View Source
pubsub_options!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Pub-sub options.

iex> Yggdrasil.Settings.pubsub_options!()
[pool_size: 1]

Bang version of Yggdrasil.Settings.pubsub_options/0 (fails on error).

Link to this function

put_module_registry(value, namespace \\ nil) View Source
put_module_registry(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}

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

Link to this function

put_publisher_options(value, namespace \\ nil) View Source
put_publisher_options(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}

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

Link to this function

put_pubsub_adapter(value, namespace \\ nil) View Source
put_pubsub_adapter(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}

Puts the value to Yggdrasil.Settings.pubsub_adapter/0. Optionally, receives the namespace.

Link to this function

put_pubsub_name(value, namespace \\ nil) View Source
put_pubsub_name(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}

Puts the value to Yggdrasil.Settings.pubsub_name/0. Optionally, receives the namespace.

Link to this function

put_pubsub_options(value, namespace \\ nil) View Source
put_pubsub_options(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}

Puts the value to Yggdrasil.Settings.pubsub_options/0. Optionally, receives the namespace.

Link to this function

reload_module_registry(namespace \\ nil) View Source
reload_module_registry(Skogsra.Env.namespace()) ::
  {:ok, term()} | {:error, term()}

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

Link to this function

reload_publisher_options(namespace \\ nil) View Source
reload_publisher_options(Skogsra.Env.namespace()) ::
  {:ok, term()} | {:error, term()}

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

Link to this function

reload_pubsub_adapter(namespace \\ nil) View Source
reload_pubsub_adapter(Skogsra.Env.namespace()) ::
  {:ok, term()} | {:error, term()}

Reloads the value for Yggdrasil.Settings.pubsub_adapter/0. Optionally, receives the namespace for the variable.

Link to this function

reload_pubsub_name(namespace \\ nil) View Source
reload_pubsub_name(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}

Reloads the value for Yggdrasil.Settings.pubsub_name/0. Optionally, receives the namespace for the variable.

Link to this function

reload_pubsub_options(namespace \\ nil) View Source
reload_pubsub_options(Skogsra.Env.namespace()) ::
  {:ok, term()} | {:error, term()}

Reloads the value for Yggdrasil.Settings.pubsub_options/0. Optionally, receives the namespace for the variable.