Packages

A general throttle utility. Mainly used to throttle inbound or outbound requests.

Current section

Files

Jump to
throttle lib context config.ex
Raw

lib/context/config.ex

defmodule Throttle.Context.Config do
alias Throttle.{Config, Context}
def all do
:contexts
|> Config.get([])
|> to_contexts
end
def find(name) when is_atom(name) do
:contexts
|> Config.get([])
|> Keyword.get(name)
|> Context.new
end
defp to_contexts(contexts) when is_list(contexts) do
Enum.map(contexts, fn {_, c} -> Context.new(c) end)
end
end