1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Config.Loader do
10 :configurable_from_database,
15 if Code.ensure_loaded?(Config.Reader) do
18 def read(path), do: @reader.read!(path)
20 # support for Elixir less than 1.9
29 @spec read(Path.t()) :: keyword()
31 @spec merge(keyword(), keyword()) :: keyword()
32 def merge(c1, c2), do: @reader.merge(c1, c2)
34 @spec default_config() :: keyword()
41 defp filter(configs) do
44 |> Enum.reduce([], &Keyword.put(&2, &1, filter_group(&1, configs)))
47 @spec filter_group(atom(), keyword()) :: keyword()
48 def filter_group(group, configs) do
49 Enum.reject(configs[group], fn {key, _v} ->
50 key in @reject_keys or (group == :phoenix and key == :serve_endpoints)