defmodule SudregEx.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application @impl true def start(_type, _args) do # The token cache is a tiny, credential-agnostic GenServer, so it starts by # default for a zero-config experience. Hosts that want no extra process set # `config :sudreg_ex, start_token_cache: false` and call # `SudregEx.Auth.fetch_token/1` directly. children = if Application.get_env(:sudreg_ex, :start_token_cache, true) do [SudregEx.TokenCache] else [] end opts = [strategy: :one_for_one, name: SudregEx.Supervisor] Supervisor.start_link(children, opts) end end