Yggdrasil for PostgreSQL v5.0.0 Yggdrasil.Settings.Postgres View Source
This module defines the available settings for PostgreSQL in Yggdrasil.
Link to this section Summary
Functions
Postgres database. Defaults to "postgres".
Postgres database. Defaults to "postgres".
Postgres hostname. Defaults to "localhost".
Postgres hostname. Defaults to "localhost".
Postgres max retries for the backoff algorithm. Defaults to 3.
Postgres max retries for the backoff algorithm. Defaults to 3.
Postgres password. Defaults to "postgres".
Postgres password. Defaults to "postgres".
Postgres port. Defaults to 5432.
Postgres port. Defaults to 5432.
PostgreSQL amount of publisher connections.
PostgreSQL amount of publisher connections.
Puts the value to Yggdrasil.Settings.Postgres.database/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.hostname/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.max_retries/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.password/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.port/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.publisher_connections/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.slot_size/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.subscriber_connections/0. Optionally, receives
the namespace.
Puts the value to Yggdrasil.Settings.Postgres.username/0. Optionally, receives
the namespace.
Reloads the value for Yggdrasil.Settings.Postgres.database/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.hostname/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.max_retries/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.password/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.port/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.publisher_connections/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.slot_size/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.subscriber_connections/0. Optionally, receives
the namespace for the variable.
Reloads the value for Yggdrasil.Settings.Postgres.username/0. Optionally, receives
the namespace for the variable.
Postgres slot size for the backoff algorithm. Defaults to 100.
Postgres slot size for the backoff algorithm. Defaults to 100.
PostgreSQL amount of subscriber connections.
PostgreSQL amount of subscriber connections.
Postgres username. Defaults to "postgres".
Postgres username. Defaults to "postgres".
Link to this section Functions
database(namespace \\ nil)
View Source
database(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
database(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres database. Defaults to "postgres".
iex> Yggdrasil.Settings.Postgres.database()
{:ok, "postgres"}
A call to Yggdrasil.Settings.Postgres.database():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.database(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_POSTGRES_DATABASE. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_DATABASE.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
database: :binary() # Defaults to "postgres"
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
database: :binary() # Defaults to "postgres"
]
database!(namespace \\ nil)
View Source
database!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
database!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres database. Defaults to "postgres".
iex> Yggdrasil.Settings.Postgres.database()
{:ok, "postgres"}
Bang version of Yggdrasil.Settings.Postgres.database/0 (fails on error).
hostname(namespace \\ nil)
View Source
hostname(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
hostname(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres hostname. Defaults to "localhost".
A call to Yggdrasil.Settings.Postgres.hostname():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.hostname(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_POSTGRES_HOSTNAME. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_HOSTNAME.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
hostname: :binary() # Defaults to "localhost"
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
hostname: :binary() # Defaults to "localhost"
]
hostname!(namespace \\ nil)
View Source
hostname!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
hostname!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres hostname. Defaults to "localhost".
Bang version of Yggdrasil.Settings.Postgres.hostname/0 (fails on error).
max_retries(namespace \\ nil)
View Source
max_retries(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
max_retries(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres max retries for the backoff algorithm. Defaults to 3.
The backoff algorithm is exponential:
backoff_time = pow(2, retries) * random(1, slot) * 1_000 ms
when retries <= MAX_RETRIES and slot is given by the configuration
variable Elixir.Yggdrasil.Settings.Postgres.slot_size/0 (defaults to 10 secs).
iex> Yggdrasil.Settings.Postgres.max_retries()
{:ok, 3}
A call to Yggdrasil.Settings.Postgres.max_retries():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.max_retries(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_POSTGRES_MAX_RETRIES. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_MAX_RETRIES.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
max_retries: :integer() # Defaults to 3
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
max_retries: :integer() # Defaults to 3
]
max_retries!(namespace \\ nil)
View Source
max_retries!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
max_retries!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres max retries for the backoff algorithm. Defaults to 3.
The backoff algorithm is exponential:
backoff_time = pow(2, retries) * random(1, slot) * 1_000 ms
when retries <= MAX_RETRIES and slot is given by the configuration
variable Elixir.Yggdrasil.Settings.Postgres.slot_size/0 (defaults to 10 secs).
iex> Yggdrasil.Settings.Postgres.max_retries()
{:ok, 3}
Bang version of Yggdrasil.Settings.Postgres.max_retries/0 (fails on error).
password(namespace \\ nil)
View Source
password(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
password(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres password. Defaults to "postgres".
iex> Yggdrasil.Settings.Postgres.password()
{:ok, "postgres"}
A call to Yggdrasil.Settings.Postgres.password():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.password(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_POSTGRES_PASSWORD. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_PASSWORD.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
password: :binary() # Defaults to "postgres"
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
password: :binary() # Defaults to "postgres"
]
password!(namespace \\ nil)
View Source
password!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
password!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres password. Defaults to "postgres".
iex> Yggdrasil.Settings.Postgres.password()
{:ok, "postgres"}
Bang version of Yggdrasil.Settings.Postgres.password/0 (fails on error).
port(namespace \\ nil)
View Source
port(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
port(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres port. Defaults to 5432.
iex> Yggdrasil.Settings.Postgres.port()
{:ok, 5432}
A call to Yggdrasil.Settings.Postgres.port():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.port(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_POSTGRES_PORT. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_PORT.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
port: :integer() # Defaults to 5432
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
port: :integer() # Defaults to 5432
]
port!(namespace \\ nil)
View Source
port!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
port!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres port. Defaults to 5432.
iex> Yggdrasil.Settings.Postgres.port()
{:ok, 5432}
Bang version of Yggdrasil.Settings.Postgres.port/0 (fails on error).
publisher_connections(namespace \\ nil)
View Source
publisher_connections(Skogsra.Env.namespace()) ::
{:ok, term()} | {:error, term()}
publisher_connections(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
PostgreSQL amount of publisher connections.
iex> Yggdrasil.Settings.Postgres.publisher_connections()
{:ok, 1}
A call to Yggdrasil.Settings.Postgres.publisher_connections():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.publisher_connections(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_POSTGRES_PUBLISHER_CONNECTIONS. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_PUBLISHER_CONNECTIONS.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
publisher_connections: :integer() # Defaults to 1
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
publisher_connections: :integer() # Defaults to 1
]
publisher_connections!(namespace \\ nil)
View Source
publisher_connections!(Skogsra.Env.namespace()) ::
{:ok, term()} | {:error, term()}
publisher_connections!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
PostgreSQL amount of publisher connections.
iex> Yggdrasil.Settings.Postgres.publisher_connections()
{:ok, 1}
Bang version of Yggdrasil.Settings.Postgres.publisher_connections/0 (fails on error).
put_database(value, namespace \\ nil)
View Source
put_database(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_database(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.database/0. Optionally, receives
the namespace.
put_hostname(value, namespace \\ nil)
View Source
put_hostname(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_hostname(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.hostname/0. Optionally, receives
the namespace.
put_max_retries(value, namespace \\ nil)
View Source
put_max_retries(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_max_retries(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.max_retries/0. Optionally, receives
the namespace.
put_password(value, namespace \\ nil)
View Source
put_password(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_password(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.password/0. Optionally, receives
the namespace.
put_port(value, namespace \\ nil)
View Source
put_port(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_port(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.port/0. Optionally, receives
the namespace.
put_publisher_connections(value, namespace \\ nil)
View Source
put_publisher_connections(term(), Skogsra.Env.namespace()) ::
:ok | {:error, term()}
put_publisher_connections(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.publisher_connections/0. Optionally, receives
the namespace.
put_slot_size(value, namespace \\ nil)
View Source
put_slot_size(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_slot_size(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.slot_size/0. Optionally, receives
the namespace.
put_subscriber_connections(value, namespace \\ nil)
View Source
put_subscriber_connections(term(), Skogsra.Env.namespace()) ::
:ok | {:error, term()}
put_subscriber_connections(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.subscriber_connections/0. Optionally, receives
the namespace.
put_username(value, namespace \\ nil)
View Source
put_username(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
put_username(term(), Skogsra.Env.namespace()) :: :ok | {:error, term()}
Puts the value to Yggdrasil.Settings.Postgres.username/0. Optionally, receives
the namespace.
reload_database(namespace \\ nil)
View Source
reload_database(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_database(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.database/0. Optionally, receives
the namespace for the variable.
reload_hostname(namespace \\ nil)
View Source
reload_hostname(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_hostname(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.hostname/0. Optionally, receives
the namespace for the variable.
reload_max_retries(namespace \\ nil)
View Source
reload_max_retries(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_max_retries(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.max_retries/0. Optionally, receives
the namespace for the variable.
reload_password(namespace \\ nil)
View Source
reload_password(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_password(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.password/0. Optionally, receives
the namespace for the variable.
reload_port(namespace \\ nil)
View Source
reload_port(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_port(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.port/0. Optionally, receives
the namespace for the variable.
reload_publisher_connections(namespace \\ nil)
View Source
reload_publisher_connections(Skogsra.Env.namespace()) ::
{:ok, term()} | {:error, term()}
reload_publisher_connections(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.publisher_connections/0. Optionally, receives
the namespace for the variable.
reload_slot_size(namespace \\ nil)
View Source
reload_slot_size(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_slot_size(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.slot_size/0. Optionally, receives
the namespace for the variable.
reload_subscriber_connections(namespace \\ nil)
View Source
reload_subscriber_connections(Skogsra.Env.namespace()) ::
{:ok, term()} | {:error, term()}
reload_subscriber_connections(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.subscriber_connections/0. Optionally, receives
the namespace for the variable.
reload_username(namespace \\ nil)
View Source
reload_username(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
reload_username(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Reloads the value for Yggdrasil.Settings.Postgres.username/0. Optionally, receives
the namespace for the variable.
slot_size(namespace \\ nil)
View Source
slot_size(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
slot_size(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres slot size for the backoff algorithm. Defaults to 100.
iex> Yggdrasil.Settings.Postgres.slot_size()
{:ok, 10}
A call to Yggdrasil.Settings.Postgres.slot_size():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.slot_size(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_POSTGRES_SLOT_SIZE. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_SLOT_SIZE.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
slot_size: :integer() # Defaults to 10
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
slot_size: :integer() # Defaults to 10
]
slot_size!(namespace \\ nil)
View Source
slot_size!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
slot_size!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres slot size for the backoff algorithm. Defaults to 100.
iex> Yggdrasil.Settings.Postgres.slot_size()
{:ok, 10}
Bang version of Yggdrasil.Settings.Postgres.slot_size/0 (fails on error).
subscriber_connections(namespace \\ nil)
View Source
subscriber_connections(Skogsra.Env.namespace()) ::
{:ok, term()} | {:error, term()}
subscriber_connections(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
PostgreSQL amount of subscriber connections.
iex> Yggdrasil.Settings.Postgres.subscriber_connections()
{:ok, 1}
A call to Yggdrasil.Settings.Postgres.subscriber_connections():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.subscriber_connections(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_POSTGRES_SUBSCRIBER_CONNECTIONS. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_SUBSCRIBER_CONNECTIONS.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
subscriber_connections: :integer() # Defaults to 1
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
subscriber_connections: :integer() # Defaults to 1
]
subscriber_connections!(namespace \\ nil)
View Source
subscriber_connections!(Skogsra.Env.namespace()) ::
{:ok, term()} | {:error, term()}
subscriber_connections!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
PostgreSQL amount of subscriber connections.
iex> Yggdrasil.Settings.Postgres.subscriber_connections()
{:ok, 1}
Bang version of Yggdrasil.Settings.Postgres.subscriber_connections/0 (fails on error).
username(namespace \\ nil)
View Source
username(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
username(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres username. Defaults to "postgres".
iex> Yggdrasil.Settings.Postgres.username()
{:ok, "postgres"}
A call to Yggdrasil.Settings.Postgres.username():
- When the OS environment variable is not
nil, then it'll return its casted value. - When the OS environment variable is
nil, then it'll try to get the value from the configuration file. - When the configuration file does not contain the variable, then it'll return the default value if it's defined.
- 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.Postgres.username(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_POSTGRES_USERNAME. - When a namespace is specified e.g.
My.Custom.Namespace, then it'll be$MY_CUSTOM_NAMESPACE_YGGDRASIL_POSTGRES_USERNAME.
The expected application configuration would be as follows:
- Without namespace:
config :yggdrasil,
postgres: [
username: :binary() # Defaults to "postgres"
]
- With namespace e.g.
My.Custom.Namespace:
config :yggdrasil, My.Custom.Namespace,
postgres: [
username: :binary() # Defaults to "postgres"
]
username!(namespace \\ nil)
View Source
username!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
username!(Skogsra.Env.namespace()) :: {:ok, term()} | {:error, term()}
Postgres username. Defaults to "postgres".
iex> Yggdrasil.Settings.Postgres.username()
{:ok, "postgres"}
Bang version of Yggdrasil.Settings.Postgres.username/0 (fails on error).