extend reject MRF to check if originating instance is blocked
[akkoma] / lib / pleroma / config / loader.ex
index 0f3ecf1ede46fc07d0cbc589411439d942763187..2a945999ed7730a067331f7661b1b63f6f841038 100644 (file)
@@ -1,17 +1,24 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Config.Loader do
+  # These modules are only being used as keys here (for equality check),
+  # so it's okay to use `Module.concat/1` to have the compiler ignore them.
   @reject_keys [
-    Pleroma.Repo,
-    Pleroma.Web.Endpoint,
+    Module.concat(["Pleroma.Repo"]),
+    Module.concat(["Pleroma.Web.Endpoint"]),
     :env,
     :configurable_from_database,
     :database,
     :swarm
   ]
 
+  @reject_groups [
+    :postgrex,
+    :tesla
+  ]
+
   if Code.ensure_loaded?(Config.Reader) do
     @reader Config.Reader
 
@@ -47,7 +54,8 @@ defmodule Pleroma.Config.Loader do
   @spec filter_group(atom(), keyword()) :: keyword()
   def filter_group(group, configs) do
     Enum.reject(configs[group], fn {key, _v} ->
-      key in @reject_keys or (group == :phoenix and key == :serve_endpoints) or group == :postgrex
+      key in @reject_keys or group in @reject_groups or
+        (group == :phoenix and key == :serve_endpoints)
     end)
   end
 end