Ithibati.Config (Ithibati v0.6.2)

Copy Markdown View Source

Reads and validates the application's Ithibati configuration.

:users_key_type and :table_prefix are read at compile time because they define schema fields and table names. Configure them before compiling Ithibati. The account schema, invitation schema and repo are read at runtime, when the consuming application's modules are available.

Ithibati.Identity.Sessions reads and validates :session_validity. initial_claim: :operator_code protects Ithibati.Identity.Instance.claim/2. The relying-party ID and origin are per-call ceremony parameters, not Ithibati configuration.

Configuration and schemas lists the keys, defaults and migration requirements.

Summary

Functions

Returns an account struct if it belongs to the configured account schema.

Returns :open or :operator_code for the first account claim.

Returns the configured invitation schema module, or nil when none is configured.

Returns the configured invitation schema or raises ArgumentError when it is absent.

Returns the configured Ecto repo module.

Returns an Ithibati table name with the compiled prefix.

Returns the compiled table-name prefix (default: ithibati).

Returns the configured account schema module.

Returns the compiled account foreign-key type: :id or :binary_id (default).

Functions

account!(account)

Returns an account struct if it belongs to the configured account schema.

Raises ArgumentError for another struct or any non-struct value. This prevents an unrelated schema's ID from being treated as an account ID. It does not query the database or verify that the account row still exists.

initial_claim_mode()

Returns :open or :operator_code for the first account claim.

invitation_schema()

Returns the configured invitation schema module, or nil when none is configured.

Raises ArgumentError if the module lacks the Ithibati.Schema.Invitation integration or its identifier field differs from the configured account schema's identifier.

invitation_schema!()

Returns the configured invitation schema or raises ArgumentError when it is absent.

Performs the same schema and identifier checks as invitation_schema/0. Use the non-bang variant when the absence of invitations is an expected configuration.

repo()

Returns the configured Ecto repo module.

Raises ArgumentError when :repo is missing or the module does not export Ecto's adapter marker. This check does not start the repo or establish database connectivity; Ithibati.Doctor.examine/1 checks whether it responds.

table(suffix)

Returns an Ithibati table name with the compiled prefix.

For example, table("keys") returns "ithibati_keys" under the default configuration. This prefix is part of the table name, not a PostgreSQL schema name.

table_prefix()

Returns the compiled table-name prefix (default: ithibati).

user_schema()

Returns the configured account schema module.

Raises ArgumentError when :user_schema is missing or the module does not export the integration generated by Ithibati.Schema.User. This validates the schema module, not its underlying table.

users_key_type()

Returns the compiled account foreign-key type: :id or :binary_id (default).