aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/config.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-12-16 17:51:48 +0100
committerlain <lain@soykaf.club>2020-12-21 16:35:12 +0100
commit5db1e6c8d37ea114433afe0a9247314ab92cc52f (patch)
treeb3f390a757f6d21eff3fa63368de129f3747c9da /lib/pleroma/config.ex
parent0ef0aed205f7298d82649f55615193baac4b3667 (diff)
downloadpleroma-5db1e6c8d37ea114433afe0a9247314ab92cc52f.tar.gz
Pipeline test: Switch from Mock to Mox.
Speeds up the test and makes it possible to run async.
Diffstat (limited to 'lib/pleroma/config.ex')
-rw-r--r--lib/pleroma/config.ex10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex
index 97f877595..1ee4777f6 100644
--- a/lib/pleroma/config.ex
+++ b/lib/pleroma/config.ex
@@ -2,15 +2,24 @@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
+defmodule Pleroma.Config.Getting do
+ @callback get(any()) :: any()
+ @callback get(any(), any()) :: any()
+end
+
defmodule Pleroma.Config do
+ @behaviour Pleroma.Config.Getting
defmodule Error do
defexception [:message]
end
+ @impl true
def get(key), do: get(key, nil)
+ @impl true
def get([key], default), do: get(key, default)
+ @impl true
def get([_ | _] = path, default) do
case fetch(path) do
{:ok, value} -> value
@@ -18,6 +27,7 @@ defmodule Pleroma.Config do
end
end
+ @impl true
def get(key, default) do
Application.get_env(:pleroma, key, default)
end