Forja.Config
(Forja v0.4.0)
View Source
Configuration struct for a Forja instance.
Stores validated configuration in :persistent_term for O(1) reads
without message passing. Each Forja instance is identified by a unique name.
Fields
:name- Atom identifying the instance (required):repo- Ecto.Repo module (required):pubsub- Phoenix.PubSub module (required):oban_name- Oban instance name (default:Oban):default_queue- Default Oban queue used for event jobs (default::events):event_topic_prefix- Prefix for PubSub topics (default:"forja"):handlers- List of modules implementingForja.Handler(default:[]):dead_letter- Module implementingForja.DeadLetter(default:nil, optional):reconciliation- Keyword list for reconciliation settings (default: see below)
Reconciliation defaults
reconciliation: [
enabled: true,
interval_minutes: 60,
threshold_minutes: 15,
max_retries: 3
]
Summary
Functions
Retrieves the configuration stored in :persistent_term by name.
Stores the configuration in :persistent_term indexed by the name field.
Types
Functions
Retrieves the configuration stored in :persistent_term by name.
Raises ArgumentError if the configuration is not found.
Creates a new Config struct from a keyword list.
Validates that the required fields (:name, :repo, :pubsub) are present.
Raises ArgumentError if any required field is missing.
Examples
iex> Forja.Config.new(name: :my_app, repo: MyApp.Repo, pubsub: MyApp.PubSub)
%Forja.Config{name: :my_app, repo: MyApp.Repo, pubsub: MyApp.PubSub, ...}
@spec store(t()) :: :ok
Stores the configuration in :persistent_term indexed by the name field.
The key used is {Forja.Config, name}.