Tinkex.Config (Tinkex v0.2.1)
View SourceClient configuration for the Tinkex SDK.
Instances of this struct are passed through every API call to support
multi-tenant usage (different API keys, base URLs, timeouts, and retry policies
within the same BEAM VM). Construction is the only place where we consult
Application.get_env/3; the request hot path only works with the struct that
callers provide.
Summary
Functions
Return BEAM-conservative default max_retries (2).
Return BEAM-conservative default timeout (120s).
Build a config struct using runtime options + application/env defaults.
Return Python SDK parity max_retries (10).
Return Python SDK parity timeout (60s).
Validate an existing config struct.
Types
@type t() :: %Tinkex.Config{ api_key: String.t(), base_url: String.t(), cf_access_client_id: String.t() | nil, cf_access_client_secret: String.t() | nil, default_headers: map(), default_query: map(), dump_headers?: boolean(), feature_gates: [String.t()] | nil, http_client: module(), http_pool: atom(), log_level: :debug | :info | :warn | :error | nil, max_retries: non_neg_integer(), proxy: proxy(), proxy_headers: [{String.t(), String.t()}], recovery: Tinkex.Recovery.Policy.t() | nil, tags: [String.t()] | nil, telemetry_enabled?: boolean(), timeout: pos_integer(), user_metadata: map() | nil }
Functions
@spec default_max_retries() :: non_neg_integer()
Return BEAM-conservative default max_retries (2).
@spec default_timeout() :: pos_integer()
Return BEAM-conservative default timeout (120s).
Build a config struct using runtime options + application/env defaults.
max_retries is the number of additional attempts after the initial request.
With the default of 10, the SDK will perform up to eleven total attempts.
Parity Mode
Tinkex defaults to Python SDK parity values to ease cross-language migration:
timeout: 60_000(1 minute)max_retries: 10(11 total attempts)
To opt into BEAM-conservative defaults instead, set parity mode to :beam:
# Via options
config = Tinkex.Config.new(parity_mode: :beam)
# Via application config
config :tinkex, parity_mode: :beam
# Via environment variable
export TINKEX_PARITY=beamExplicit timeout/max_retries options always override parity defaults.
@spec python_max_retries() :: non_neg_integer()
Return Python SDK parity max_retries (10).
@spec python_timeout() :: pos_integer()
Return Python SDK parity timeout (60s).
Validate an existing config struct.