Railsr.Config (Railsr v1.0.0)

Copy Markdown View Source

Runtime configuration for the railsr client.

All values are read from Application.get_env(:railsr, ...) at startup and validated via NimbleOptions. Keys can be overridden per-request by passing opts to any resource function.

Keys

KeyTypeDefaultDescription
:client_idstringrequiredRailsr OAuth 2.0 client ID
:client_secretstringrequiredRailsr OAuth 2.0 client secret

| :environment | :play | :play_live | :live | :play | Target Railsr environment | | :timeout | pos_integer | 30_000 | HTTP request timeout in ms | | :max_retries | non_neg_integer | 3 | Max retry attempts on transient errors | | :base_backoff_ms | pos_integer | 200 | Base backoff interval for retries | | :telemetry_prefix | [atom] | [:railsr] | Telemetry event prefix | | :pool_size | pos_integer | 10 | Finch connection pool size | | :rate_limit_rps | pos_integer | 50 | Max requests per second |

Summary

Functions

Returns all validated config as a keyword list.

Returns the base URL for the configured (or overridden) environment.

Retrieves a single config value with an optional default.

Returns the OAuth token endpoint URL.

Validates application config at startup. Raises ArgumentError on invalid values.

Functions

all()

@spec all() :: keyword()

Returns all validated config as a keyword list.

base_url(env \\ nil)

@spec base_url(atom() | nil) :: String.t()

Returns the base URL for the configured (or overridden) environment.

get(key, default \\ nil)

@spec get(atom(), any()) :: any()

Retrieves a single config value with an optional default.

token_url(env \\ nil)

@spec token_url(atom() | nil) :: String.t()

Returns the OAuth token endpoint URL.

validate!()

@spec validate!() :: :ok

Validates application config at startup. Raises ArgumentError on invalid values.