Tinkex.Env (Tinkex v0.3.4)
View SourceCentralized environment variable access for Tinkex.
Naming Convention
TINKER_*variables: Shared with Python SDK for cross-language compatibilityTINKEX_*variables: Elixir-specific features (pool config, debug tools)CLOUDFLARE_*variables: Third-party service credentials
Normalizes values, applies defaults, and provides helpers for redaction so
callers avoid scattered System.get_env/1 usage.
Summary
Functions
Get default headers map from environment.
Get default query params map from environment.
Get custom HTTP client module from environment.
Get HTTP pool name from environment.
Replace a secret with a constant marker.
Get OpenTelemetry propagation setting from environment.
Get parity mode from environment.
Get future polling backoff policy from environment.
Get HTTP pool count from environment.
Get HTTP pool size from environment.
Get proxy configuration from environment.
Get proxy headers from environment.
Redact secrets in a snapshot or map using simple replacement.
Snapshot all known env-driven values in one map.
Types
Functions
@spec api_key(env_source()) :: String.t() | nil
@spec base_url(env_source()) :: String.t() | nil
@spec cf_access_client_id(env_source()) :: String.t() | nil
@spec cf_access_client_secret(env_source()) :: String.t() | nil
@spec default_headers(env_source()) :: map()
Get default headers map from environment.
Set TINKEX_DEFAULT_HEADERS to a JSON object of header name/value pairs.
@spec default_query(env_source()) :: map()
Get default query params map from environment.
Set TINKEX_DEFAULT_QUERY to a JSON object of query name/value pairs.
@spec dump_headers?(env_source()) :: boolean()
@spec feature_gates(env_source()) :: [String.t()]
@spec http_client(env_source()) :: module() | nil
Get custom HTTP client module from environment.
Set TINKEX_HTTP_CLIENT to a module name (e.g., Tinkex.API).
@spec http_pool(env_source()) :: atom() | nil
Get HTTP pool name from environment.
Set TINKEX_HTTP_POOL to an atom name (e.g., Tinkex.HTTP.Pool).
@spec log_level(env_source()) :: :debug | :info | :warn | :error | nil
Replace a secret with a constant marker.
@spec otel_propagate(env_source()) :: boolean()
Get OpenTelemetry propagation setting from environment.
Set TINKEX_OTEL_PROPAGATE=true to enable W3C Trace Context propagation.
When enabled, outgoing requests will carry traceparent/tracestate headers.
@spec parity_mode(env_source()) :: :python | :beam | nil
Get parity mode from environment.
Defaults to Python parity. Set TINKEX_PARITY=beam to use BEAM-conservative
defaults (timeout: 120_000, max_retries: 2), or TINKEX_PARITY=python to
explicitly select Python SDK defaults (timeout: 60_000, max_retries: 10).
@spec poll_backoff(env_source()) :: :exponential | nil
Get future polling backoff policy from environment.
Set TINKEX_POLL_BACKOFF=exponential (or truthy value) to enable backoff
for 408/5xx polling retries. Use TINKEX_POLL_BACKOFF=0 to disable.
@spec pool_count(env_source()) :: pos_integer() | nil
Get HTTP pool count from environment.
Set TINKEX_POOL_COUNT to override the number of connection pools.
@spec pool_size(env_source()) :: pos_integer() | nil
Get HTTP pool size from environment.
Python SDK uses max_connections=1000 by default.
Set TINKEX_POOL_SIZE to override.
@spec proxy(env_source()) :: String.t() | nil
Get proxy configuration from environment.
Set TINKEX_PROXY to a URL string like "http://proxy.example.com:8080"
or "http://user:pass@proxy.example.com:8080".
@spec proxy_headers(env_source()) :: [{String.t(), String.t()}]
Get proxy headers from environment.
Set TINKEX_PROXY_HEADERS to a JSON array of {name, value} tuples.
Example: TINKEX_PROXY_HEADERS='[["proxy-authorization", "Basic abc123"]]'
Redact secrets in a snapshot or map using simple replacement.
@spec snapshot(env_source()) :: map()
Snapshot all known env-driven values in one map.
@spec tags(env_source()) :: [String.t()]
@spec telemetry_enabled?(env_source()) :: boolean()