esdb_gater_config (erl_esdb_gater v0.6.6)

View Source

Global configuration for erl-esdb-gater

Manages gateway-wide configuration including capability security modes.

Capability modes:

  • disabled - Capabilities never checked (development/testing)
  • optional - Capabilities verified if provided, allowed if not
  • required - Capabilities always required for protected operations

Configuration is read from application environment with capability_mode set to disabled, optional, or required.

Per-channel overrides take precedence. If a channel has requires_capability/0 returning true, that channel always requires capabilities regardless of the global setting.

Summary

Functions

Get the global capability mode Defaults to disabled for backwards compatibility.

Get effective mode considering channel override

Set the global capability mode at runtime Use for testing or dynamic configuration.

Types

capability_mode/0

-type capability_mode() :: disabled | optional | required.

Functions

capability_mode()

-spec capability_mode() -> capability_mode().

Get the global capability mode Defaults to disabled for backwards compatibility.

effective_capability_mode(_)

-spec effective_capability_mode(boolean()) -> capability_mode().

Get effective mode considering channel override

If the channel explicitly requires capabilities (ChannelOverride = true`), the mode is always `required. Otherwise the global mode applies.

This implements a "most restrictive wins" policy: - Channel override true + any global mode = required - Channel override false + global mode = global mode

set_capability_mode(Mode)

-spec set_capability_mode(capability_mode()) -> ok.

Set the global capability mode at runtime Use for testing or dynamic configuration.