1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Config.Loader do
6 # These modules are only being used as keys here (for equality check),
7 # so it's okay to use `Module.concat/1` to have the compiler ignore them.
9 Module.concat(["Pleroma.Repo"]),
10 Module.concat(["Pleroma.Web.Endpoint"]),
12 :configurable_from_database,
24 @spec read(Path.t()) :: keyword()
25 def read(path), do: @reader.read!(path)
27 @spec merge(keyword(), keyword()) :: keyword()
28 def merge(c1, c2), do: @reader.merge(c1, c2)
30 @spec default_config() :: keyword()
37 defp filter(configs) do
40 |> Enum.reduce([], &Keyword.put(&2, &1, filter_group(&1, configs)))
43 @spec filter_group(atom(), keyword()) :: keyword()
44 def filter_group(group, configs) do
45 Enum.reject(configs[group], fn {key, _v} ->
46 key in @reject_keys or group in @reject_groups or
47 (group == :phoenix and key == :serve_endpoints)