SetuClient.Config (Setu Client v1.0.0)

Copy Markdown View Source

Central configuration struct for the Setu SDK.

Application config

config :setu,
  client_id: System.get_env("SETU_CLIENT_ID"),
  client_secret: System.get_env("SETU_CLIENT_SECRET"),
  product_instance_id: System.get_env("SETU_PRODUCT_INSTANCE_ID"),
  environment: :sandbox,
  timeout: 30_000,
  max_retries: 3,
  retry_base_delay: 500,
  retry_max_delay: 10_000,
  rate_limit_rps: 100,
  rate_limit_burst: 20

Per-request override

cfg = SetuClient.Config.new(environment: :production, timeout: 60_000)

Summary

Functions

Returns the KYC / AA credential headers derived from the config.

Builds a SetuClient.Config from application config merged with keyword overrides.

Returns the resolved base URLs for the config's environment.

Raises ArgumentError if required fields are missing or invalid.

Types

environment()

@type environment() :: :sandbox | :production

t()

@type t() :: %SetuClient.Config{
  client_id: String.t() | nil,
  client_secret: String.t() | nil,
  environment: environment(),
  max_retries: non_neg_integer(),
  product_instance_id: String.t() | nil,
  rate_limit_burst: pos_integer(),
  rate_limit_rps: pos_integer(),
  retry_base_delay: pos_integer(),
  retry_max_delay: pos_integer(),
  telemetry_prefix: [atom()],
  timeout: pos_integer()
}

Functions

kyc_headers(cfg)

@spec kyc_headers(t()) :: [{String.t(), String.t()}]

Returns the KYC / AA credential headers derived from the config.

new(overrides \\ [])

@spec new(keyword()) :: t()

Builds a SetuClient.Config from application config merged with keyword overrides.

urls(config)

@spec urls(t()) :: %{required(atom()) => String.t()}

Returns the resolved base URLs for the config's environment.

validate!(cfg)

@spec validate!(t()) :: t()

Raises ArgumentError if required fields are missing or invalid.