Lithic.Config (Lithic v1.0.0)

Copy Markdown View Source

Runtime configuration resolver for the Lithic client.

Configuration Keys

  • :api_key — Lithic API key (required). Defaults to LITHIC_API_KEY env var.
  • :environment:production (default) or :sandbox.
  • :receive_timeout — HTTP receive timeout in ms (default: 30_000).
  • :connect_timeout — HTTP connect timeout in ms (default: 10_000).
  • :max_retries — Max retry attempts on 5xx/network errors (default: 3).
  • :retry_base_delay — Base backoff delay in ms (default: 500).
  • :retry_max_delay — Max backoff delay in ms (default: 30_000).
  • :default_page_size — Default pagination page size (default: 50).
  • :telemetry_prefix — Telemetry event prefix (default: [:lithic]).

Usage

# Application config
config :lithic, api_key: "your_key", environment: :sandbox

# Runtime override per-request
Lithic.Cards.list(client: Lithic.Client.new(api_key: "other_key"))

Summary

Functions

Returns the base URL for a given environment.

Builds a resolved config map from application env + overrides.

Types

t()

@type t() :: %{
  api_key: String.t(),
  environment: :production | :sandbox,
  base_url: String.t(),
  receive_timeout: non_neg_integer(),
  connect_timeout: non_neg_integer(),
  max_retries: non_neg_integer(),
  retry_base_delay: non_neg_integer(),
  retry_max_delay: non_neg_integer(),
  default_page_size: pos_integer(),
  telemetry_prefix: [atom()]
}

Functions

base_url(env)

@spec base_url(:production | :sandbox) :: String.t()

Returns the base URL for a given environment.

resolve(overrides \\ [])

@spec resolve(keyword()) :: t()

Builds a resolved config map from application env + overrides.