Handle non-list keys in Config.fetch/1

This commit is contained in:
Roman Chvanikov 2020-08-05 18:23:12 +03:00
commit 8c57a299b4
2 changed files with 4 additions and 0 deletions

View file

@ -32,6 +32,8 @@ defmodule Pleroma.Config do
end
end
def fetch(key) when is_atom(key), do: fetch([key])
def fetch([root_key | keys]) do
Enum.reduce_while(keys, Application.fetch_env(:pleroma, root_key), fn
key, {:ok, config} when is_map(config) or is_list(config) ->