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 database. Defaults to 0
Redis hostname. Defaults to "localhost"
Redis hostname. Defaults to "localhost"
Redis password. Defaults to nil
Redis password. Defaults to nil
Redis port. Defaults to 6379
Redis port. Defaults to 6379
Link to this section Functions
Redis database. Defaults to 0
.
A call to Yggdrasil.Settings.Redis.yggdrasil_redis_database()
will:
- If the OS environment variable is not
nil
, will return its casted value. - If the OS environment variable is
nil
, then it will try to get the value in the configuration file. - If the configuration file does not contain the value, will return the default value if it’s defined.
- 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()
.
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.
Redis hostname. Defaults to "localhost"
.
A call to Yggdrasil.Settings.Redis.yggdrasil_redis_hostname()
will:
- If the OS environment variable is not
nil
, will return its casted value. - If the OS environment variable is
nil
, then it will try to get the value in the configuration file. - If the configuration file does not contain the value, will return the default value if it’s defined.
- 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()
.
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.
Redis password. Defaults to nil
.
A call to Yggdrasil.Settings.Redis.yggdrasil_redis_password()
will:
- If the OS environment variable is not
nil
, will return its casted value. - If the OS environment variable is
nil
, then it will try to get the value in the configuration file. - If the configuration file does not contain the value, will return the default value if it’s defined.
- 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()
.
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.
Redis port. Defaults to 6379
.
A call to Yggdrasil.Settings.Redis.yggdrasil_redis_port()
will:
- If the OS environment variable is not
nil
, will return its casted value. - If the OS environment variable is
nil
, then it will try to get the value in the configuration file. - If the configuration file does not contain the value, will return the default value if it’s defined.
- 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()
.
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.