yggdrasil_redis v4.1.3 Yggdrasil.Settings.Redis View Source

This module defines the available settings for Redis in Yggdrasil.

Link to this section Summary

Functions

Redis database. Defaults to 0

Redis hostname. Defaults to "localhost"

Redis hostname. Defaults to "localhost"

Redis password. Defaults to nil

Redis port. Defaults to 6379

Link to this section Functions

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

Redis database. Defaults to 0.

A call to Yggdrasil.Settings.Redis.yggdrasil_redis_database() 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 Yggdrasil.Settings.Redis.yggdrasil_redis_database(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 OS environment variable expected is $YGGDRASIL_REDIS_DATABASE. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_REDIS_DATABASE.

The expected application configuration is as follows:

config :yggdrasil,
  redis: [
    database: integer() # Defaults to 0
  ]

and with a namespace, for example Namespace, the expected application configuration would be:

config :yggdrasil, Namespace,
  redis: [
    database: integer() # Defaults to 0
  ]

For testing purposes, the value can be reloaded at runtime with the function Yggdrasil.Settings.Redis.yggdrasil_redis_database(namespace, :reload) where namespace can be nil or an atom().

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

Redis database. Defaults to 0.

Same as Yggdrasil.Settings.Redis.yggdrasil_redis_database/0 but fails on error.

It can receive also a namespace when needed.

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

Redis hostname. Defaults to "localhost".

A call to Yggdrasil.Settings.Redis.yggdrasil_redis_hostname() 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 Yggdrasil.Settings.Redis.yggdrasil_redis_hostname(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 OS environment variable expected is $YGGDRASIL_REDIS_HOSTNAME. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_REDIS_HOSTNAME.

The expected application configuration is as follows:

config :yggdrasil,
  redis: [
    hostname: binary() # Defaults to "localhost"
  ]

and with a namespace, for example Namespace, the expected application configuration would be:

config :yggdrasil, Namespace,
  redis: [
    hostname: binary() # Defaults to "localhost"
  ]

For testing purposes, the value can be reloaded at runtime with the function Yggdrasil.Settings.Redis.yggdrasil_redis_hostname(namespace, :reload) where namespace can be nil or an atom().

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

Redis hostname. Defaults to "localhost".

Same as Yggdrasil.Settings.Redis.yggdrasil_redis_hostname/0 but fails on error.

It can receive also a namespace when needed.

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

Redis password. Defaults to nil.

A call to Yggdrasil.Settings.Redis.yggdrasil_redis_password() 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 Yggdrasil.Settings.Redis.yggdrasil_redis_password(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 OS environment variable expected is $YGGDRASIL_REDIS_PASSWORD. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_REDIS_PASSWORD.

The expected application configuration is as follows:

config :yggdrasil,
  redis: [
    password: :binary()
  ]

and with a namespace, for example Namespace, the expected application configuration would be:

config :yggdrasil, Namespace,
  redis: [
    password: :binary()
  ]

For testing purposes, the value can be reloaded at runtime with the function Yggdrasil.Settings.Redis.yggdrasil_redis_password(namespace, :reload) where namespace can be nil or an atom().

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

Redis password. Defaults to nil.

Same as Yggdrasil.Settings.Redis.yggdrasil_redis_password/0 but fails on error.

It can receive also a namespace when needed.

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

Redis port. Defaults to 6379.

A call to Yggdrasil.Settings.Redis.yggdrasil_redis_port() 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 Yggdrasil.Settings.Redis.yggdrasil_redis_port(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 OS environment variable expected is $YGGDRASIL_REDIS_PORT. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_REDIS_PORT.

The expected application configuration is as follows:

config :yggdrasil,
  redis: [
    port: integer() # Defaults to 6379
  ]

and with a namespace, for example Namespace, the expected application configuration would be:

config :yggdrasil, Namespace,
  redis: [
    port: integer() # Defaults to 6379
  ]

For testing purposes, the value can be reloaded at runtime with the function Yggdrasil.Settings.Redis.yggdrasil_redis_port(namespace, :reload) where namespace can be nil or an atom().

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

Redis port. Defaults to 6379.

Same as Yggdrasil.Settings.Redis.yggdrasil_redis_port/0 but fails on error.

It can receive also a namespace when needed.