1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Config.Loader do
11 :configurable_from_database,
22 if Code.ensure_loaded?(Config.Reader) do
25 def read(path), do: @reader.read!(path)
27 # support for Elixir less than 1.9
36 @spec read(Path.t()) :: keyword()
38 @spec merge(keyword(), keyword()) :: keyword()
39 def merge(c1, c2), do: @reader.merge(c1, c2)
41 @spec default_config() :: keyword()
48 defp filter(configs) do
51 |> Enum.reduce([], &Keyword.put(&2, &1, filter_group(&1, configs)))
54 @spec filter_group(atom(), keyword()) :: keyword()
55 def filter_group(group, configs) do
56 Enum.reject(configs[group], fn {key, _v} ->
57 key in reject_keys() or group in reject_groups() or
58 (group == :phoenix and key == :serve_endpoints)