ExESDB.Commanded.Config (ex_esdb_commanded v0.4.0)

Simple configuration for ExESDB.Commanded.Adapter.

Expects configuration in the standard Commanded format:

config :my_otp_app, MyApp.CommandedApp,
  event_store: [
    event_type_mapper: MyApp.EventTypeMapper,
    store_id: :my_store,
    log_level: :info,
    adapter: ExESDB.Commanded.Adapter,
    stream_prefix: "my_app_"
  ]

Summary

Functions

Gets event store configuration from the application config.

Gets the event type mapper from configuration.

Gets a specific configuration value with a default.

Gets the log level from configuration.

Gets the serializer module from configuration.

Gets the store ID from configuration.

Gets the stream prefix from configuration.

Validates the event store configuration and warns about missing critical components.

Validates that the event type mapper module exists and has required functions.

Types

config()

@type config() :: Keyword.t()

Functions

event_store_config(otp_app, commanded_app)

@spec event_store_config(atom(), atom()) :: Keyword.t()

Gets event store configuration from the application config.

The otp_app and commanded_app are passed from the adapter's child_spec.

event_type_mapper(otp_app, commanded_app)

@spec event_type_mapper(atom(), atom()) :: module() | nil

Gets the event type mapper from configuration.

get_config(otp_app, commanded_app, key, default \\ nil)

@spec get_config(atom(), atom(), atom(), any()) :: any()

Gets a specific configuration value with a default.

log_level(otp_app, commanded_app)

@spec log_level(atom(), atom()) :: atom()

Gets the log level from configuration.

serializer(otp_app, commanded_app)

@spec serializer(atom(), atom()) :: module()

Gets the serializer module from configuration.

store_id(otp_app, commanded_app)

@spec store_id(atom(), atom()) :: atom()

Gets the store ID from configuration.

stream_prefix(otp_app, commanded_app)

@spec stream_prefix(atom(), atom()) :: String.t()

Gets the stream prefix from configuration.

validate_event_store_config(config, otp_app, commanded_app)

@spec validate_event_store_config(Keyword.t(), atom(), atom()) :: Keyword.t()

Validates the event store configuration and warns about missing critical components.

validate_event_type_mapper(mapper)

@spec validate_event_type_mapper(module()) :: :ok

Validates that the event type mapper module exists and has required functions.