StarlingBank.Config (StarlingBank v1.0.0)

Copy Markdown View Source

Runtime configuration resolution for StarlingBank.

Configuration can be supplied in three ways, resolved in this order of precedence (highest first):

  1. Options passed directly to a client call (opts[:access_token], etc.)

  2. A named client struct built with StarlingBank.Client.new/1

  3. Application environment:

    config :starling_bank, access_token: {:system, "STARLING_ACCESS_TOKEN"}, environment: :sandbox, receive_timeout: 15_000, retry: [max_attempts: 3, base_delay_ms: 250]

Summary

Functions

Builds a StarlingBank.Config struct, resolving values from the given opts, falling back to application environment.

Types

environment()

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

t()

@type t() :: %StarlingBank.Config{
  access_token: String.t() | nil,
  base_url: String.t(),
  connect_timeout: pos_integer(),
  environment: environment(),
  receive_timeout: pos_integer(),
  retry: keyword(),
  transport: module(),
  user_agent: String.t()
}

Functions

base_url_for(atom)

@spec base_url_for(environment()) :: String.t()

new(opts \\ [])

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

Builds a StarlingBank.Config struct, resolving values from the given opts, falling back to application environment.