Astarte.RPC.Config (astarte_rpc v1.0.2) View Source

This module helps the access to the runtime configuration of Astarte RPC

Link to this section Summary

Functions

The hostname or IP of the AMQP broker.

The hostname or IP of the AMQP broker.

Password for accessing the AMQP broker.

Password for accessing the AMQP broker.

The port of the AMQP broker to connect to.

The port of the AMQP broker to connect to.

Specifies the certificates of the root Certificate Authorities to be trusted. When not specified, the bundled cURL certificate bundle will be used.

Specifies the certificates of the root Certificate Authorities to be trusted. When not specified, the bundled cURL certificate bundle will be used.

Specify the hostname to be used in TLS Server Name Indication extension. If not specified, the amqp host will be used. This value is used only if Server Name Indication is enabled.

Specify the hostname to be used in TLS Server Name Indication extension. If not specified, the amqp host will be used. This value is used only if Server Name Indication is enabled.

Disable Server Name Indication. Defaults to false.

Disable Server Name Indication. Defaults to false.

Enable SSL. If not specified, SSL is disabled.

Enable SSL. If not specified, SSL is disabled.

Username for accessing the AMQP broker.

Username for accessing the AMQP broker.

The Virtual Host to be used in the AMQP broker. Must be the same for all components.

The Virtual Host to be used in the AMQP broker. Must be the same for all components.

Returns the amqp_connection options or an empty list if they're not set.

The prefetch count of the AMQP connection. A prefetch count of 0 means unlimited (not recommended).

The prefetch count of the AMQP connection. A prefetch count of 0 means unlimited (not recommended).

The AMQP queue arguments.

Max length of the server AMQP queue. If 0 the queue will be unbounded, otherwise it will be limited to tha t length and new publishes will be dropped while the queue is full. WARNING: changing this value requires manually deleting the queue

Max length of the server AMQP queue. If 0 the queue will be unbounded, otherwise it will be limited to tha t length and new publishes will be dropped while the queue is full. WARNING: changing this value requires manually deleting the queue

Preloads all variables in a namespace if supplied.

Reloads the value for Astarte.RPC.Config.amqp_connection_host/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_password/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_port/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_ca_file/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_custom_sni/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_disable_sni/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_enabled/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_username/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_connection_virtual_host/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_prefetch_count/0. Optionally, receives the namespace for the variable.

Reloads the value for Astarte.RPC.Config.amqp_queue_max_length/0. Optionally, receives the namespace for the variable.

Creates a template for OS environment variables given a filename. Additionally, it can receive a list of options

Validates that all required variables are present. Returns :ok if they are, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

Link to this section Types

Specs

argument() :: {:"x-max-length", integer()} | {:"x-overflow", String.t()}

Specs

options() ::
  {:username, String.t()}
  | {:password, String.t()}
  | {:virtual_host, String.t()}
  | {:host, String.t()}
  | {:port, integer()}
  | {:ssl_options, ssl_options()}

Specs

ssl_option() ::
  {:cacertfile, String.t()}
  | {:verify, :verify_peer}
  | {:server_name_indication, :disable | charlist()}
  | {:depth, integer()}

Specs

ssl_options() :: :none | [ssl_option()]

Link to this section Functions

Link to this function

amqp_connection_host(namespace \\ nil)

View Source

Specs

amqp_connection_host(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

The hostname or IP of the AMQP broker.

Calling Astarte.RPC.Config.amqp_connection_host() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_HOST"
  • Type: :binary
  • Default: "localhost"
  • Required: false
  • Cached: true
Link to this function

amqp_connection_host!(namespace \\ nil)

View Source

Specs

amqp_connection_host!(Skogsra.Env.namespace()) :: binary() | no_return()

The hostname or IP of the AMQP broker.

Bang version of Astarte.RPC.Config.amqp_connection_host/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_password(namespace \\ nil)

View Source

Specs

amqp_connection_password(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Password for accessing the AMQP broker.

Calling Astarte.RPC.Config.amqp_connection_password() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_PASSWORD"
  • Type: :binary
  • Default: "guest"
  • Required: false
  • Cached: true
Link to this function

amqp_connection_password!(namespace \\ nil)

View Source

Specs

amqp_connection_password!(Skogsra.Env.namespace()) :: binary() | no_return()

Password for accessing the AMQP broker.

Bang version of Astarte.RPC.Config.amqp_connection_password/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_port(namespace \\ nil)

View Source

Specs

amqp_connection_port(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

The port of the AMQP broker to connect to.

Calling Astarte.RPC.Config.amqp_connection_port() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_PORT"
  • Type: :integer
  • Default: 5672
  • Required: false
  • Cached: true
Link to this function

amqp_connection_port!(namespace \\ nil)

View Source

Specs

amqp_connection_port!(Skogsra.Env.namespace()) :: integer() | no_return()

The port of the AMQP broker to connect to.

Bang version of Astarte.RPC.Config.amqp_connection_port/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_ssl_ca_file(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_ca_file(Skogsra.Env.namespace()) ::
  {:ok, nil | binary()} | {:error, binary()}

Specifies the certificates of the root Certificate Authorities to be trusted. When not specified, the bundled cURL certificate bundle will be used.

Calling Astarte.RPC.Config.amqp_connection_ssl_ca_file() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_SSL_CA_FILE"
  • Type: :binary
  • Default: nil
  • Required: false
  • Cached: true
Link to this function

amqp_connection_ssl_ca_file!(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_ca_file!(Skogsra.Env.namespace()) ::
  (nil | binary()) | no_return()

Specifies the certificates of the root Certificate Authorities to be trusted. When not specified, the bundled cURL certificate bundle will be used.

Bang version of Astarte.RPC.Config.amqp_connection_ssl_ca_file/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_ssl_custom_sni(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_custom_sni(Skogsra.Env.namespace()) ::
  {:ok, nil | binary()} | {:error, binary()}

Specify the hostname to be used in TLS Server Name Indication extension. If not specified, the amqp host will be used. This value is used only if Server Name Indication is enabled.

Calling Astarte.RPC.Config.amqp_connection_ssl_custom_sni() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_SSL_CUSTOM_SNI"
  • Type: :binary
  • Default: nil
  • Required: false
  • Cached: true
Link to this function

amqp_connection_ssl_custom_sni!(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_custom_sni!(Skogsra.Env.namespace()) ::
  (nil | binary()) | no_return()

Specify the hostname to be used in TLS Server Name Indication extension. If not specified, the amqp host will be used. This value is used only if Server Name Indication is enabled.

Bang version of Astarte.RPC.Config.amqp_connection_ssl_custom_sni/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_ssl_disable_sni(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_disable_sni(Skogsra.Env.namespace()) ::
  {:ok, boolean()} | {:error, binary()}

Disable Server Name Indication. Defaults to false.

Calling Astarte.RPC.Config.amqp_connection_ssl_disable_sni() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_SSL_DISABLE_SNI"
  • Type: :boolean
  • Default: false
  • Required: false
  • Cached: true
Link to this function

amqp_connection_ssl_disable_sni!(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_disable_sni!(Skogsra.Env.namespace()) ::
  boolean() | no_return()

Disable Server Name Indication. Defaults to false.

Bang version of Astarte.RPC.Config.amqp_connection_ssl_disable_sni/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_ssl_enabled(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_enabled(Skogsra.Env.namespace()) ::
  {:ok, boolean()} | {:error, binary()}

Enable SSL. If not specified, SSL is disabled.

Calling Astarte.RPC.Config.amqp_connection_ssl_enabled() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_SSL_ENABLED"
  • Type: :boolean
  • Default: false
  • Required: false
  • Cached: true
Link to this function

amqp_connection_ssl_enabled!(namespace \\ nil)

View Source

Specs

amqp_connection_ssl_enabled!(Skogsra.Env.namespace()) :: boolean() | no_return()

Enable SSL. If not specified, SSL is disabled.

Bang version of Astarte.RPC.Config.amqp_connection_ssl_enabled/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_username(namespace \\ nil)

View Source

Specs

amqp_connection_username(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Username for accessing the AMQP broker.

Calling Astarte.RPC.Config.amqp_connection_username() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_USERNAME"
  • Type: :binary
  • Default: "guest"
  • Required: false
  • Cached: true
Link to this function

amqp_connection_username!(namespace \\ nil)

View Source

Specs

amqp_connection_username!(Skogsra.Env.namespace()) :: binary() | no_return()

Username for accessing the AMQP broker.

Bang version of Astarte.RPC.Config.amqp_connection_username/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

amqp_connection_virtual_host(namespace \\ nil)

View Source

Specs

amqp_connection_virtual_host(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

The Virtual Host to be used in the AMQP broker. Must be the same for all components.

Calling Astarte.RPC.Config.amqp_connection_virtual_host() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_CONNECTION_VIRTUAL_HOST"
  • Type: :binary
  • Default: "/"
  • Required: false
  • Cached: true
Link to this function

amqp_connection_virtual_host!(namespace \\ nil)

View Source

Specs

amqp_connection_virtual_host!(Skogsra.Env.namespace()) :: binary() | no_return()

The Virtual Host to be used in the AMQP broker. Must be the same for all components.

Bang version of Astarte.RPC.Config.amqp_connection_virtual_host/0 (fails on error). Optionally, receives the namespace for the variable.

Specs

amqp_options!() :: [options()]

Returns the amqp_connection options or an empty list if they're not set.

Link to this function

amqp_prefetch_count(namespace \\ nil)

View Source

Specs

amqp_prefetch_count(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

The prefetch count of the AMQP connection. A prefetch count of 0 means unlimited (not recommended).

Calling Astarte.RPC.Config.amqp_prefetch_count() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_PREFETCH_COUNT"
  • Type: :integer
  • Default: 300
  • Required: true
  • Cached: true
Link to this function

amqp_prefetch_count!(namespace \\ nil)

View Source

Specs

amqp_prefetch_count!(Skogsra.Env.namespace()) :: integer() | no_return()

The prefetch count of the AMQP connection. A prefetch count of 0 means unlimited (not recommended).

Bang version of Astarte.RPC.Config.amqp_prefetch_count/0 (fails on error). Optionally, receives the namespace for the variable.

Specs

amqp_queue_arguments!() :: [argument()]

The AMQP queue arguments.

Link to this function

amqp_queue_max_length(namespace \\ nil)

View Source

Specs

amqp_queue_max_length(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Max length of the server AMQP queue. If 0 the queue will be unbounded, otherwise it will be limited to tha t length and new publishes will be dropped while the queue is full. WARNING: changing this value requires manually deleting the queue

Calling Astarte.RPC.Config.amqp_queue_max_length() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "RPC_AMQP_QUEUE_MAX_LENGTH"
  • Type: :integer
  • Default: 0
  • Required: false
  • Cached: true
Link to this function

amqp_queue_max_length!(namespace \\ nil)

View Source

Specs

amqp_queue_max_length!(Skogsra.Env.namespace()) :: integer() | no_return()

Max length of the server AMQP queue. If 0 the queue will be unbounded, otherwise it will be limited to tha t length and new publishes will be dropped while the queue is full. WARNING: changing this value requires manually deleting the queue

Bang version of Astarte.RPC.Config.amqp_queue_max_length/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

preload(namespace \\ nil)

View Source

Specs

preload(Skogsra.Env.namespace()) :: :ok

Preloads all variables in a namespace if supplied.

Link to this function

put_amqp_connection_host(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_host(binary(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_host/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_password(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_password(binary(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_password/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_port(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_port(integer(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_port/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_ssl_ca_file(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_ssl_ca_file(nil | binary(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_ssl_ca_file/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_ssl_custom_sni(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_ssl_custom_sni(nil | binary(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_ssl_custom_sni/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_ssl_disable_sni(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_ssl_disable_sni(boolean(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_ssl_disable_sni/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_ssl_enabled(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_ssl_enabled(boolean(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_ssl_enabled/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_username(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_username(binary(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_username/0. Optionally, receives the namespace.

Link to this function

put_amqp_connection_virtual_host(value, namespace \\ nil)

View Source

Specs

put_amqp_connection_virtual_host(binary(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_connection_virtual_host/0. Optionally, receives the namespace.

Link to this function

put_amqp_prefetch_count(value, namespace \\ nil)

View Source

Specs

put_amqp_prefetch_count(integer(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_prefetch_count/0. Optionally, receives the namespace.

Link to this function

put_amqp_queue_max_length(value, namespace \\ nil)

View Source

Specs

put_amqp_queue_max_length(integer(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Astarte.RPC.Config.amqp_queue_max_length/0. Optionally, receives the namespace.

Link to this function

reload_amqp_connection_host(namespace \\ nil)

View Source

Specs

reload_amqp_connection_host(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_host/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_password(namespace \\ nil)

View Source

Specs

reload_amqp_connection_password(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_password/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_port(namespace \\ nil)

View Source

Specs

reload_amqp_connection_port(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_port/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_ssl_ca_file(namespace \\ nil)

View Source

Specs

reload_amqp_connection_ssl_ca_file(Skogsra.Env.namespace()) ::
  {:ok, nil | binary()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_ca_file/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_ssl_custom_sni(namespace \\ nil)

View Source

Specs

reload_amqp_connection_ssl_custom_sni(Skogsra.Env.namespace()) ::
  {:ok, nil | binary()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_custom_sni/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_ssl_disable_sni(namespace \\ nil)

View Source

Specs

reload_amqp_connection_ssl_disable_sni(Skogsra.Env.namespace()) ::
  {:ok, boolean()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_disable_sni/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_ssl_enabled(namespace \\ nil)

View Source

Specs

reload_amqp_connection_ssl_enabled(Skogsra.Env.namespace()) ::
  {:ok, boolean()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_ssl_enabled/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_username(namespace \\ nil)

View Source

Specs

reload_amqp_connection_username(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_username/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_connection_virtual_host(namespace \\ nil)

View Source

Specs

reload_amqp_connection_virtual_host(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_connection_virtual_host/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_prefetch_count(namespace \\ nil)

View Source

Specs

reload_amqp_prefetch_count(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_prefetch_count/0. Optionally, receives the namespace for the variable.

Link to this function

reload_amqp_queue_max_length(namespace \\ nil)

View Source

Specs

reload_amqp_queue_max_length(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Astarte.RPC.Config.amqp_queue_max_length/0. Optionally, receives the namespace for the variable.

Link to this function

template(filename, options \\ [])

View Source

Specs

template(Path.t(), keyword()) :: :ok | {:error, File.posix()}

Creates a template for OS environment variables given a filename. Additionally, it can receive a list of options:

  • type: What kind of file it will generate (:elixir, :unix, :windows).
  • namespace: Namespace for the variables.
Link to this function

validate(namespace \\ nil)

View Source

Specs

validate(Skogsra.Env.namespace()) :: :ok | {:error, [binary()]}

Validates that all required variables are present. Returns :ok if they are, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

It is possible to provide a namespace as argument (defaults to nil).

Link to this function

validate!(namespace \\ nil)

View Source

Specs

validate!(Skogsra.Env.namespace()) :: :ok | no_return()

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

It is possible to provide a namespace as argument (defaults to nil).