Resolves which provider and which API key a call should use.
Resolution order
For the provider:
opts[:provider]if present.Application.get_env(:ex_atlas, :default_provider).- Raises
ArgumentError.
For the API key (per provider):
opts[:api_key]if present.Application.get_env(:ex_atlas, provider)[:api_key].- Environment variable (e.g.
RUNPOD_API_KEY,LAMBDA_LABS_API_KEY). nil(providers decide whether to raise).
This mirrors the stripity_stripe / ex_aws pattern: per-call overrides win,
application config is the default, no global mutable state. Multi-tenant hosts
pass api_key: per request and skip config entirely.
Configuring the default provider
# config/config.exs
config :ex_atlas,
default_provider: :runpod,
start_orchestrator: false
config :ex_atlas, :runpod, api_key: System.get_env("RUNPOD_API_KEY")
config :ex_atlas, :lambda_labs, api_key: System.get_env("LAMBDA_LABS_API_KEY")
Summary
Functions
Build the ctx map passed to every provider callback.
Map of built-in provider atoms to their implementing modules.
Standard environment variable name for a provider's API key.
Pop :provider from opts and return {provider_atom_or_module, remaining_opts}.
Resolve the module that implements ExAtlas.Provider for a given provider atom.
Types
@type opts() :: keyword()
Functions
@spec build_ctx(atom() | module(), opts()) :: ExAtlas.Provider.ctx()
Build the ctx map passed to every provider callback.
Resolves the API key and any Req overrides in one place.
Map of built-in provider atoms to their implementing modules.
Standard environment variable name for a provider's API key.
Pop :provider from opts and return {provider_atom_or_module, remaining_opts}.
Resolve the module that implements ExAtlas.Provider for a given provider atom.