Astarte.RPC.Config (astarte_rpc v1.0.6) 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.
Puts the value
to Astarte.RPC.Config.amqp_connection_host/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_password/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_port/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_ssl_ca_file/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_ssl_custom_sni/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_ssl_disable_sni/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_ssl_enabled/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_username/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_connection_virtual_host/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_prefetch_count/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.RPC.Config.amqp_queue_max_length/0
. Optionally, receives
the namespace
.
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
Link to this section Functions
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
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.
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
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.
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
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.
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
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.
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
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.
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
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.
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
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.
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
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.
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
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.
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
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.
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
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.
Specs
preload(Skogsra.Env.namespace()) :: :ok
Preloads all variables in a namespace
if supplied.
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
.
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
.
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
.
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
.
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
.
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
.
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
.
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
.
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
.
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
.
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
.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
).
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
).