Central config resolution for CouncilEx.
Two-tier model:
:mode— high-level deployment shape.:single_node(default) keeps all state in-memory (ETS / no recorder).:multi_nodedefaults every persistent backend to its*.Ectomodule and expects a shared:repoto be set.Per-key overrides —
:reliability_store,:registry_backend,:recorderset explicitly always win over mode defaults. Mix and match (e.g.Reliability.Redis+Registry.Ecto) by setting just the keys you want to override.
Examples
# Single node (default — no config needed):
# ETS-backed Registry, no Reliability store, no Recorder.
# Multi-node, one repo for everything:
config :council_ex,
mode: :multi_node,
repo: MyApp.Repo,
pubsub: {CouncilEx.PubSub.Phoenix, name: MyApp.PubSub}
# Multi-node, override one backend:
config :council_ex,
mode: :multi_node,
repo: MyApp.Repo,
reliability_store: CouncilEx.Reliability.Redis,
recorder: nilRepo resolution
*.Ecto backends call repo!/1, which checks per-module config first
(config :council_ex, CouncilEx.Reliability.Ecto, repo: ...) then
falls back to the shared key (config :council_ex, repo: ...).
Summary
Functions
Boot-time sanity check. Emits Logger.warning/1 for likely
misconfigs (e.g. mode: :multi_node selected but no repo resolvable
for an *.Ecto backend). Pure — no side effects beyond log output.
Return the configured deployment mode. Defaults to :single_node.
Raises if the value isn't one of [:single_node, :multi_node].
Resolve the default recorder. Returns {module, args} ready for
CouncilEx.start/3, or nil to indicate no recorder.
Resolve the registry backend module. Per-key override wins; falls back to the mode default.
Resolve the reliability store module. Per-key override wins; falls back to the mode default.
Resolve the Ecto.Repo for module. Reads
config :council_ex, module, repo: ... first, then shared
config :council_ex, repo: .... Returns nil if neither set.
Same as repo/1 but raises with a helpful message when no repo is
set anywhere.
Functions
@spec check() :: :ok
Boot-time sanity check. Emits Logger.warning/1 for likely
misconfigs (e.g. mode: :multi_node selected but no repo resolvable
for an *.Ecto backend). Pure — no side effects beyond log output.
@spec mode() :: :single_node | :multi_node
Return the configured deployment mode. Defaults to :single_node.
Raises if the value isn't one of [:single_node, :multi_node].
Resolve the default recorder. Returns {module, args} ready for
CouncilEx.start/3, or nil to indicate no recorder.
Accepts either a bare module (treated as {module, %{}}) or a
{module, map} tuple in config. Explicit nil opts out even when
mode would default to a recorder.
@spec registry_backend() :: module()
Resolve the registry backend module. Per-key override wins; falls back to the mode default.
@spec reliability_store() :: module()
Resolve the reliability store module. Per-key override wins; falls back to the mode default.
Resolve the Ecto.Repo for module. Reads
config :council_ex, module, repo: ... first, then shared
config :council_ex, repo: .... Returns nil if neither set.
Same as repo/1 but raises with a helpful message when no repo is
set anywhere.