Packages
avrora
0.21.0
0.30.2
0.30.1
0.30.0
0.29.2
0.29.1
0.29.0
0.28.0
0.27.0
0.26.0
0.25.0
0.24.2
0.24.1
0.24.0
0.23.0
0.22.0
0.21.1
0.21.0
0.20.0
0.19.0
0.18.1
0.18.0
0.17.0
0.16.0
0.15.0
0.14.1
0.14.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.1
0.9.0
0.8.1
0.8.0
0.7.1
0.7.0
0.6.0
0.5.1
0.5.0
0.4.0
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.1-beta
0.1.0-beta
An Elixir library for working with Avro messages conveniently. It supports local schema files and Confluent® schema registry.
Current section
Files
Jump to
Current section
Files
lib/avrora/config.ex
defmodule Avrora.Config do
@moduledoc """
Configuration for Avrora.
## Options:
* `schemas_path` path to local schema files, default `./priv/schemas`
* `registry_url` URL for Schema Registry, default `nil`
* `registry_auth` authentication settings for Schema Registry, default `nil`
* `registry_schemas_autoreg` automatically register schemas in Schema Registry, default `true`
* `convert_null_values` convert `:null` values in the decoded message into `nil`, default `true`
* `convert_map_to_proplist` bring back old behavior and configure decoding AVRO map-type as proplist, default `false`
* `names_cache_ttl` duration to cache global schema names millisecods, default `:infinity`
## Internal use interface:
* `file_storage` module which handles files in `schemas_path`, default `Avrora.Storage.File`
* `memory_storage` module which handles memory operations, default `Avrora.Storage.Memory`
* `registry_storage` module which handles Schema Registry requests, default `Avrora.Storage.Registry`
* `http_client` module which handles HTTP client requests to Schema Registry, default `Avrora.HTTPClient`
* `ets_lib` module which creates ETS tables with call `Module.new/0`
"""
@callback schemas_path :: String.t()
@callback registry_url :: String.t() | nil
@callback registry_auth :: tuple() | nil
@callback registry_schemas_autoreg :: boolean()
@callback convert_null_values :: boolean()
@callback convert_map_to_proplist :: boolean()
@callback names_cache_ttl :: integer() | atom()
@callback file_storage :: module()
@callback memory_storage :: module()
@callback registry_storage :: module()
@callback http_client :: module()
@callback ets_lib :: module() | atom()
@doc false
def schemas_path, do: get_env(:schemas_path, Path.expand("./priv/schemas"))
@doc false
def registry_url, do: get_env(:registry_url, nil)
@doc false
def registry_auth, do: get_env(:registry_auth, nil)
@doc false
def registry_schemas_autoreg, do: get_env(:registry_schemas_autoreg, true)
@doc false
def convert_null_values, do: get_env(:convert_null_values, true)
@doc false
def convert_map_to_proplist, do: get_env(:convert_map_to_proplist, false)
@doc false
def names_cache_ttl, do: get_env(:names_cache_ttl, :infinity)
@doc false
def file_storage, do: Avrora.Storage.File
@doc false
def memory_storage, do: Avrora.Storage.Memory
@doc false
def registry_storage, do: Avrora.Storage.Registry
@doc false
def http_client, do: Avrora.HTTPClient
@doc false
def ets_lib, do: Avrora.AvroSchemaStore
@doc false
def self, do: get_env(:config, Avrora.Config)
defp get_env(name, default), do: Application.get_env(:avrora, name, default)
end