yggdrasil_postgres v4.1.2 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 12

Postgres max retries for the backoff algorithm. Defaults to 12

Postgres password. Defaults to "postgres"

Postgres password. Defaults to "postgres"

Postgres port. Defaults to 5432

Postgres slot size for the backoff algorithm. Defaults to 100

Postgres slot size for the backoff algorithm. Defaults to 100

Postgres username. Defaults to "postgres"

Postgres username. Defaults to "postgres"

Link to this section Functions

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

Postgres database. Defaults to "postgres".

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_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.Postgres.yggdrasil_postgres_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_POSTGRES_DATABASE. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_DATABASE.

The expected application configuration is as follows:

config :yggdrasil,
  postgres: [
    database: binary() # Defaults to "postgres"
  ]

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

config :yggdrasil, Namespace,
  postgres: [
    database: binary() # Defaults to "postgres"
  ]

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

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

Postgres database. Defaults to "postgres".

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_database/0 but fails on error.

It can receive also a namespace when needed.

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

Postgres hostname. Defaults to "localhost".

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_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.Postgres.yggdrasil_postgres_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_POSTGRES_HOSTNAME. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_HOSTNAME.

The expected application configuration is as follows:

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

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

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

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

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

Postgres hostname. Defaults to "localhost".

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_hostname/0 but fails on error.

It can receive also a namespace when needed.

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

Postgres max retries for the backoff algorithm. Defaults to 12.

The backoff algorithm is exponential:

backoff_time = pow(2, retries) * random(1, slot) ms

when retries <= MAX_RETRIES and slot is given by the configuration variable Elixir.Yggdrasil.Settings.Postgres.yggdrasil_postgres_slot_size/0 (defaults to 100 ms).

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_max_retries() 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.Postgres.yggdrasil_postgres_max_retries(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_POSTGRES_MAX_RETRIES. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_MAX_RETRIES.

The expected application configuration is as follows:

config :yggdrasil,
  postgres: [
    max_retries: integer() # Defaults to 12
  ]

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

config :yggdrasil, Namespace,
  postgres: [
    max_retries: integer() # Defaults to 12
  ]

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

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

Postgres max retries for the backoff algorithm. Defaults to 12.

The backoff algorithm is exponential:

backoff_time = pow(2, retries) * random(1, slot) ms

when retries <= MAX_RETRIES and slot is given by the configuration variable Elixir.Yggdrasil.Settings.Postgres.yggdrasil_postgres_slot_size/0 (defaults to 100 ms).

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_max_retries/0 but fails on error.

It can receive also a namespace when needed.

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

Postgres password. Defaults to "postgres".

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_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.Postgres.yggdrasil_postgres_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_POSTGRES_PASSWORD. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_PASSWORD.

The expected application configuration is as follows:

config :yggdrasil,
  postgres: [
    password: binary() # Defaults to "postgres"
  ]

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

config :yggdrasil, Namespace,
  postgres: [
    password: binary() # Defaults to "postgres"
  ]

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

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

Postgres password. Defaults to "postgres".

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_password/0 but fails on error.

It can receive also a namespace when needed.

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

Postgres port. Defaults to 5432.

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_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.Postgres.yggdrasil_postgres_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_POSTGRES_PORT. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_PORT.

The expected application configuration is as follows:

config :yggdrasil,
  postgres: [
    port: integer() # Defaults to 5432
  ]

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

config :yggdrasil, Namespace,
  postgres: [
    port: integer() # Defaults to 5432
  ]

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

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

Postgres port. Defaults to 5432.

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_port/0 but fails on error.

It can receive also a namespace when needed.

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

Postgres slot size for the backoff algorithm. Defaults to 100.

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_slot_size() 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.Postgres.yggdrasil_postgres_slot_size(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_POSTGRES_SLOT_SIZE. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_SLOT_SIZE.

The expected application configuration is as follows:

config :yggdrasil,
  postgres: [
    slot_size: integer() # Defaults to 100
  ]

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

config :yggdrasil, Namespace,
  postgres: [
    slot_size: integer() # Defaults to 100
  ]

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

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

Postgres slot size for the backoff algorithm. Defaults to 100.

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_slot_size/0 but fails on error.

It can receive also a namespace when needed.

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

Postgres username. Defaults to "postgres".

A call to Yggdrasil.Settings.Postgres.yggdrasil_postgres_username() 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.Postgres.yggdrasil_postgres_username(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_POSTGRES_USERNAME. If there is a namespace, for example Namespace, the OS environment variable would be $NAMESPACE_YGGDRASIL_POSTGRES_USERNAME.

The expected application configuration is as follows:

config :yggdrasil,
  postgres: [
    username: binary() # Defaults to "postgres"
  ]

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

config :yggdrasil, Namespace,
  postgres: [
    username: binary() # Defaults to "postgres"
  ]

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

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

Postgres username. Defaults to "postgres".

Same as Yggdrasil.Settings.Postgres.yggdrasil_postgres_username/0 but fails on error.

It can receive also a namespace when needed.