fp/apps/bright/lib/bright.ex
CJ_Clippy aa75c224fc
Some checks failed
ci / build (push) Failing after 23m29s
ci / Tests & Checks (push) Failing after 3m32s
move services/bright to apps/bright
2025-02-10 08:16:50 -08:00

24 lines
697 B
Elixir

defmodule Bright do
@moduledoc """
Bright keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
@doc """
Looks up `Application` config or raises if keyspace is not configured.
"""
def config([main_key | rest] = keyspace) when is_list(keyspace) do
main = Application.fetch_env!(:bright, main_key)
Enum.reduce(rest, main, fn next_key, current ->
case Keyword.fetch(current, next_key) do
{:ok, val} -> val
:error -> raise ArgumentError, "no config found under #{inspect(keyspace)}"
end
end)
end
end