Settings of the dangerous-operation flow of the shop API: when an operation needs a confirmation, how long a code, an approval and a stored idempotent answer live.
| Setting | Default | Allowed |
|---|---|---|
api_confirm_batch_over | 50 | 1 to 500 |
api_confirm_ttl_seconds | 120 | 10 to 600 |
api_approval_ttl_hours | 72 | 1 to 720 |
api_approval_pending_max | 20 | 1 to 1000 |
api_idempotency_ttl_hours | 24 | 1 to 720 |
api_idempotency_lease_seconds | 120 | 5 to 3600 |
(api_confirm_price_change_pct belongs to the e-commerce module.)
A stored value that does not parse or is below its minimum reads as the default;
one above its maximum reads as the maximum. A Settings read error reads as the
default (PhoenixKit.API.Config.int/2).
The same table drives the form on Settings -> API: fields/0, current/0,
validate/1 and save/2. The form is all or nothing: one invalid field saves
nothing, and only the values that changed are written (each as a permanent
setting.changed Activity entry through Settings.update_setting_with_module/4).
Summary
Functions
Pending approvals one key may hold (api_approval_pending_max).
Hours a pending approval lives (api_approval_ttl_hours).
Rows above which an admin write is dangerous (api_confirm_batch_over).
Seconds a confirmation code lives (api_confirm_ttl_seconds, at most 600).
The current value of every form field, as the text the field shows.
The six fields of the form, in the order the page shows them.
Seconds an in_progress idempotency claim holds before a retry may take over.
Hours a stored idempotent answer lives (api_idempotency_ttl_hours).
Validates and writes a form. Returns the settings that changed. opts are the
history options of Settings.update_setting_with_module/4 (actor_uuid:,
source:).
Checks a submitted form. {:ok, [{setting, integer}]} when every field is a whole
number inside its range; otherwise {:error, fields} naming every bad field
(a missing field is bad, never the default).
Functions
@spec approval_pending_max() :: pos_integer()
Pending approvals one key may hold (api_approval_pending_max).
@spec approval_ttl_hours() :: pos_integer()
Hours a pending approval lives (api_approval_ttl_hours).
@spec confirm_batch_over() :: pos_integer()
Rows above which an admin write is dangerous (api_confirm_batch_over).
@spec confirm_ttl_seconds() :: pos_integer()
Seconds a confirmation code lives (api_confirm_ttl_seconds, at most 600).
The current value of every form field, as the text the field shows.
@spec fields() :: [map()]
The six fields of the form, in the order the page shows them.
@spec idempotency_lease_seconds() :: pos_integer()
Seconds an in_progress idempotency claim holds before a retry may take over.
@spec idempotency_ttl_hours() :: pos_integer()
Hours a stored idempotent answer lives (api_idempotency_ttl_hours).
Validates and writes a form. Returns the settings that changed. opts are the
history options of Settings.update_setting_with_module/4 (actor_uuid:,
source:).
Checks a submitted form. {:ok, [{setting, integer}]} when every field is a whole
number inside its range; otherwise {:error, fields} naming every bad field
(a missing field is bad, never the default).