ConfigHelper (config_helper v1.0.0)
Helper functions used in config/runtime.exs
Summary
Functions
Get value from environment variable, converting it to the given type if needed.
Make a test database URL by appending _test_<partition>
to the path of the given URI
Remove the sslmode
query parameter from a URI
Types
config_type()
@type config_type() :: :str | :int | :bool | :json | :atom
Functions
get_env(var, default \\ :no_default, type \\ :str)
@spec get_env(String.t(), :no_default | any(), config_type()) :: any()
Get value from environment variable, converting it to the given type if needed.
If no default value is given, or :no_default
is given as the default, an error is raised if the variable is not
set.
make_test_database_url(database_url, mix_test_partition)
Make a test database URL by appending _test_<partition>
to the path of the given URI
remove_sslmode_from_uri(uri)
Remove the sslmode
query parameter from a URI
This is particularly needed to deploy a Commanded app to Fly.io when using
the commanded/event_store
library, because Fly.io automatically addes the
sslmode param and the event store library does not support it (raises an
ArgumentError if it is present.)