Optional supervisor that starts Daraja.TokenCache. Add it to your
application's supervision tree to enable token caching across all API calls:
children = [
{Daraja.Supervisor, []}
]The library is process-free by default; caching is opt-in.
Custom names (umbrella apps)
Use name: to name the supervisor and cache_name: to name the cache
process and its ETS table. They must be distinct atoms:
{Daraja.Supervisor, name: :billing_sup, cache_name: :billing_cache}Then point Daraja.Auth.get_token/1 at the custom cache via config:
# config/config.exs (or the appropriate umbrella child config)
config :daraja, token_cache: :billing_cacheEach BEAM node can only register one ETS named table per atom. Starting two
supervisors with the same cache_name: (or both using the default) will
fail at startup.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for Supervisor.init/1.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for Supervisor.init/1.