Astarte.DataAccess.Config (astarte_data_access v1.1.1) View Source
This module helps the access to the runtime configuration of Astarte Data Access
Link to this section Summary
Functions
Discover nodes in the same cluster as specified in CASSANDRA_NODES. If your Cassandra instance is outside of your network, enabling the autodiscovery leads to connection failures. Defaults to false.
Discover nodes in the same cluster as specified in CASSANDRA_NODES. If your Cassandra instance is outside of your network, enabling the autodiscovery leads to connection failures. Defaults to false.
The password used to log into cassandra. Defaults to 'cassandra'.
The password used to log into cassandra. Defaults to 'cassandra'.
The username used to log into cassandra. Defaults to "cassandra".
The username used to log into cassandra. Defaults to "cassandra".
A list of {host, port} values of accessible Cassandra nodes in a cqex compliant format
A list of {host, port} values of accessible Cassandra nodes in a cqex compliant format
The number of connections to start for the pool, Defaults to 10.
The number of connections to start for the pool, Defaults to 10.
Preloads all variables in a namespace
if supplied.
Puts the value
to Astarte.DataAccess.Config.autodiscovery_enabled/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.cassandra_password/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.cassandra_username/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.cqex_nodes/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.pool_size/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.ssl_ca_file/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.ssl_custom_sni/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.ssl_disable_sni/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.ssl_enabled/0
. Optionally, receives
the namespace
.
Puts the value
to Astarte.DataAccess.Config.xandra_nodes/0
. Optionally, receives
the namespace
.
Reloads the value for Astarte.DataAccess.Config.autodiscovery_enabled/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.cassandra_password/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.cassandra_username/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.cqex_nodes/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.pool_size/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.ssl_ca_file/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.ssl_custom_sni/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.ssl_disable_sni/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.ssl_enabled/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Astarte.DataAccess.Config.xandra_nodes/0
. Optionally, receives
the namespace
for the variable.
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 cassandra nodes 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 cassandra nodes 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 for Cassandra connections. Defaults to false.
Enable SSL for Cassandra connections. Defaults to false.
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.
A list of host values of accessible Cassandra nodes formatted in the Xandra format
A list of host values of accessible Cassandra nodes formatted in the Xandra format
Link to this section Types
Specs
Specs
cqex_opts() :: {:ssl, ssl_options()} | {:auth, auth_options()} | {:keyspace, String.t()}
Specs
Specs
ssl_options() :: :none | [ssl_option()]
Link to this section Functions
Specs
autodiscovery_enabled(Skogsra.Env.namespace()) :: {:ok, boolean()} | {:error, binary()}
Discover nodes in the same cluster as specified in CASSANDRA_NODES. If your Cassandra instance is outside of your network, enabling the autodiscovery leads to connection failures. Defaults to false.
Calling Astarte.DataAccess.Config.autodiscovery_enabled()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_AUTODISCOVERY_ENABLED"
- Type: :boolean
- Default: false
- Required: false
- Cached: true
Specs
autodiscovery_enabled!(Skogsra.Env.namespace()) :: boolean() | no_return()
Discover nodes in the same cluster as specified in CASSANDRA_NODES. If your Cassandra instance is outside of your network, enabling the autodiscovery leads to connection failures. Defaults to false.
Bang version of Astarte.DataAccess.Config.autodiscovery_enabled/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
cassandra_password(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}
The password used to log into cassandra. Defaults to 'cassandra'.
Calling Astarte.DataAccess.Config.cassandra_password()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_PASSWORD"
- Type: :binary
- Default: "cassandra"
- Required: false
- Cached: true
Specs
cassandra_password!(Skogsra.Env.namespace()) :: binary() | no_return()
The password used to log into cassandra. Defaults to 'cassandra'.
Bang version of Astarte.DataAccess.Config.cassandra_password/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
cassandra_username(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}
The username used to log into cassandra. Defaults to "cassandra".
Calling Astarte.DataAccess.Config.cassandra_username()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_USERNAME"
- Type: :binary
- Default: "cassandra"
- Required: false
- Cached: true
Specs
cassandra_username!(Skogsra.Env.namespace()) :: binary() | no_return()
The username used to log into cassandra. Defaults to "cassandra".
Bang version of Astarte.DataAccess.Config.cassandra_username/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
cqex_nodes(Skogsra.Env.namespace()) :: {:ok, Astarte.DataAccess.Config.CQExNodes.t()} | {:error, binary()}
A list of {host, port} values of accessible Cassandra nodes in a cqex compliant format
Calling Astarte.DataAccess.Config.cqex_nodes()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_NODES"
- Type: Astarte.DataAccess.Config.CQExNodes
- Default: [{"localhost", 9042}]
- Required: false
- Cached: true
Specs
cqex_nodes!(Skogsra.Env.namespace()) :: Astarte.DataAccess.Config.CQExNodes.t() | no_return()
A list of {host, port} values of accessible Cassandra nodes in a cqex compliant format
Bang version of Astarte.DataAccess.Config.cqex_nodes/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
cqex_options!() :: [cqex_opts()]
Specs
pool_size(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}
The number of connections to start for the pool, Defaults to 10.
Calling Astarte.DataAccess.Config.pool_size()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_POOL_SIZE"
- Type: :integer
- Default: 10
- Required: false
- Cached: true
Specs
pool_size!(Skogsra.Env.namespace()) :: integer() | no_return()
The number of connections to start for the pool, Defaults to 10.
Bang version of Astarte.DataAccess.Config.pool_size/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_autodiscovery_enabled(boolean(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.autodiscovery_enabled/0
. Optionally, receives
the namespace
.
Specs
put_cassandra_password(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.cassandra_password/0
. Optionally, receives
the namespace
.
Specs
put_cassandra_username(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.cassandra_username/0
. Optionally, receives
the namespace
.
Specs
put_cqex_nodes(Astarte.DataAccess.Config.CQExNodes.t(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.cqex_nodes/0
. Optionally, receives
the namespace
.
Specs
put_pool_size(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.pool_size/0
. Optionally, receives
the namespace
.
Specs
put_ssl_ca_file(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.ssl_ca_file/0
. Optionally, receives
the namespace
.
Specs
put_ssl_custom_sni(nil | binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.ssl_custom_sni/0
. Optionally, receives
the namespace
.
Specs
put_ssl_disable_sni(boolean(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.ssl_disable_sni/0
. Optionally, receives
the namespace
.
Specs
put_ssl_enabled(boolean(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.ssl_enabled/0
. Optionally, receives
the namespace
.
Specs
put_xandra_nodes( Astarte.DataAccess.Config.XandraNodes.t(), Skogsra.Env.namespace() ) :: :ok | {:error, binary()}
Puts the value
to Astarte.DataAccess.Config.xandra_nodes/0
. Optionally, receives
the namespace
.
Specs
reload_autodiscovery_enabled(Skogsra.Env.namespace()) :: {:ok, boolean()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.autodiscovery_enabled/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_cassandra_password(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.cassandra_password/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_cassandra_username(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.cassandra_username/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_cqex_nodes(Skogsra.Env.namespace()) :: {:ok, Astarte.DataAccess.Config.CQExNodes.t()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.cqex_nodes/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_pool_size(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.pool_size/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_ssl_ca_file(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.ssl_ca_file/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_ssl_custom_sni(Skogsra.Env.namespace()) :: {:ok, nil | binary()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.ssl_custom_sni/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_ssl_disable_sni(Skogsra.Env.namespace()) :: {:ok, boolean()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.ssl_disable_sni/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_ssl_enabled(Skogsra.Env.namespace()) :: {:ok, boolean()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.ssl_enabled/0
. Optionally, receives
the namespace
for the variable.
Specs
reload_xandra_nodes(Skogsra.Env.namespace()) :: {:ok, Astarte.DataAccess.Config.XandraNodes.t()} | {:error, binary()}
Reloads the value for Astarte.DataAccess.Config.xandra_nodes/0
. Optionally, receives
the namespace
for the variable.
Specs
ssl_ca_file(Skogsra.Env.namespace()) :: {:ok, 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.DataAccess.Config.ssl_ca_file()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_SSL_CA_FILE"
- Type: :binary
- Default: "/home/davide/SECOMind/astarte-platform/astarte_data_access/_build/dev/lib/castore/priv/cacerts.pem"
- Required: false
- Cached: true
Specs
ssl_ca_file!(Skogsra.Env.namespace()) :: 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.DataAccess.Config.ssl_ca_file/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
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 cassandra nodes will be used. This value is used only if Server Name Indication is enabled.
Calling Astarte.DataAccess.Config.ssl_custom_sni()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_SSL_CUSTOM_SNI"
- Type: :binary
- Default: nil
- Required: false
- Cached: true
Specs
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 cassandra nodes will be used. This value is used only if Server Name Indication is enabled.
Bang version of Astarte.DataAccess.Config.ssl_custom_sni/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
ssl_disable_sni(Skogsra.Env.namespace()) :: {:ok, boolean()} | {:error, binary()}
Disable Server Name Indication. Defaults to false.
Calling Astarte.DataAccess.Config.ssl_disable_sni()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_SSL_DISABLE_SNI"
- Type: :boolean
- Default: false
- Required: false
- Cached: true
Specs
ssl_disable_sni!(Skogsra.Env.namespace()) :: boolean() | no_return()
Disable Server Name Indication. Defaults to false.
Bang version of Astarte.DataAccess.Config.ssl_disable_sni/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
ssl_enabled(Skogsra.Env.namespace()) :: {:ok, boolean()} | {:error, binary()}
Enable SSL for Cassandra connections. Defaults to false.
Calling Astarte.DataAccess.Config.ssl_enabled()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_SSL_ENABLED"
- Type: :boolean
- Default: false
- Required: false
- Cached: true
Specs
ssl_enabled!(Skogsra.Env.namespace()) :: boolean() | no_return()
Enable SSL for Cassandra connections. Defaults to false.
Bang version of Astarte.DataAccess.Config.ssl_enabled/0
(fails on error). 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
).
Specs
xandra_nodes(Skogsra.Env.namespace()) :: {:ok, Astarte.DataAccess.Config.XandraNodes.t()} | {:error, binary()}
A list of host values of accessible Cassandra nodes formatted in the Xandra format
Calling Astarte.DataAccess.Config.xandra_nodes()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "CASSANDRA_NODES"
- Type: Astarte.DataAccess.Config.XandraNodes
- Default: ["localhost:9042"]
- Required: false
- Cached: true
Specs
xandra_nodes!(Skogsra.Env.namespace()) :: Astarte.DataAccess.Config.XandraNodes.t() | no_return()
A list of host values of accessible Cassandra nodes formatted in the Xandra format
Bang version of Astarte.DataAccess.Config.xandra_nodes/0
(fails on error). Optionally,
receives the namespace
for the variable.
Specs
xandra_options!() :: Xandra.start_options()